Changes

Jump to: navigation, search

Week 4 Lab

38 bytes added, 04:31, 21 April 2009
modifying for rudimentary keyboard control
}
}
* What I have done is change the <code>Serial.read()</code> and <code>analogWrite()</code> from before. Now we are reading a <code>char</code> rather than a <code>byte</code> from the Serial port, and we are checking whether this character it reads is one of the characters between '0' and '9': a letter on the keyboard was pressed, it is one of the numbers? If it is (<code>if((val>='0')&&(val<='9'))</code>) then we will set the speed of the motor proportionally.
* Compile and upload this sketch to the board:
* Typing 0-9 on the computer will set the motor speed from (0-98.8%) of full speed) (the <code>(28*val-'0'))</code> in <code>analogWrite()</code> above)

Navigation menu