Monday, March 7, 2016

SciBorgs Day 1

a) Making Functions
Challenge: Make an LED flash the Morse code for SOS
We (Jiaming, Vivian, and I) learned that we can make functions outside of loop that we can call into the loop section letting us use the same code repeatedly without having to retype everything. It's very handy because it would suck having to read and write the same code over and over again if we can simply write it once and call it again at later.




b) SciBorg Challenges:


#1: Run both motors
We copied the code from the single motor example and added that MOTOR_2 would be referred to as m2. We then made both m1 and m2 start at set up and then loop through speeding up to full speed for 1 second, movingforward at full speed at 1 second, speeding up again for 1 second but in reverse, and then moving in reverse at full speed for 1 second. The program would also print out "Going forward slowly then fast" when it was accelerating forward and print out "Going in reverse slowly then fast" when it was accelerating backwards. 



#2: Find minimum speed
In order to find minimum speed, we plugged in different numbers for the speed of the motor. We found that the lowest speed the motor will turn the wheel at is 55 but, if the SciBorg is on the floor, it will not move at a speed of 55. 
We also found that the minimum speed the SciBorg will move when it is on the floor is 75.

#3: Hard turn
In order to make the SciBorg to make a hard turn, we made the SciBorg travel straight for 5 seconds and then we made one of its motors move turn the wheel forward at full power and the other moved the other wheel backwards at full power for half a second. The combination of a large velocity in a small amount of time resulted in a hard right turn. 





#4:Soft turn
In order to make the SciBorg make a softer turn, we made the SciBorg go straight again for 5 seconds at a speed of 150 and then after 5 seconds, we made one motor continue moving the wheel it's attached to forward at the same speed while the other motor moved the other wheel at the same speed but backwards for 2.5 seconds. A smaller velocity and longer time caused the SciBorg to make a much softer slower right turn. 






We tried making the SciBorg move straight at a speed of 150 for 5 seconds and then hopefully make it softly turn by making the motors turn the wheels in opposite directions but at the minimum speed of 75 for 2.5 seconds. This did not work. The SciBorg instead just stalled for 2.5 seconds and then continued moving straight at a speed of 150.




We also tried going straight at a speed of 100 and then turning at a speed of 100 for 2.5 seconds but that also did not work well. The SciBorg would move straight and then stall and slightly move to the right. 


#5: Travel 10 feet
We first timed how long the SciBorg would take to travel 10 feet at a speed of 225. We got that it took the SciBorg 16 seconds so we wrote an if loop saying that if the program has been running for less than 16 seconds, the SciBorg would move at a speed of 225 or else it would not move and have a speed of 0. We found that the SciBorg did not always travel in a completely straight line. It often curved slightly to the left or right. Once when we ran our 16 second code, the SciBorg nearly traveled exactly 10 feet and it was only off by about half an inch. But another time, the SciBorg was 6 inches from the 10 feet line. 






The SciBorg did not stop exactly at the line because all we told it to do was travel for 16 seconds at a speed of 225. It did not take into account that it might not travel in a completely straight path or that it might hit something or slow down causing it to not travel the total 10 feet. 

Reflection:
The hardest part of these challenges was setting up all the files. We had a problem where we accidentally put one of the files into another folder which confused Arduino. The coolest challenge was making the SciBorg make a hard turn just because it was really entertaining watching the SciBorg travel in a square path. 


2 comments:

  1. Nice reflection on the importance of saving files! We have all been at that point where we can't find the file we are looking for. Good to stay organized, especially with various iterations!

    ReplyDelete
  2. Another challenge could be to upload all the files successfully without restarting the computer :-(

    ReplyDelete