On the road with Arduino
Well the Arduino UNO kit has arrived and I'm very impressed. Lots of things to try and I'm already well beyond the flashing LED tutorial that is the electronics version of HelloWorld.
Some quick experimenting has shown that the servo is easy to position using this example. Similarly I have built up a quick serial communication app that replies to a specific string (based on this). Interestingly you need to tweak PUTTY to talk to it correctly
// Command line variables
String command; // String input from command prompt
String temp1,temp2; // temporary strings
char inByte; // Byte input from command prompt
char carray[6]; // character array for string to int // manipulation
int a,b,c; // temporary numbers
void setup(){
Serial.begin(9600);
}
void loop(){
// Input serial information:
if (Serial.available() > 0){
inByte = Serial.read();
// only input if a letter, number, =,?,+ are typed!
if ((inByte >= 65 && inByte <= 90) || (inByte >=97 && inByte <=122) || (inByte >= 48 && inByte <=57) || inByte == 43 || inByte == 61 || inByte == 63) {
command.concat(inByte);
}
}// end serial.available
// Process command when NL/CR are entered:
if (inByte == 10 || inByte == 13){
if (command.equalsIgnoreCase("hey")){
Serial.println("hello there!");
} command=""; }
}