Advertisement
Guest User

Untitled

a guest
Nov 4th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char myChar;
  2. String content = "";
  3. char character;
  4. int motorControl = 1; //not really implimented yet
  5. int yCord = 0;
  6. int xCord = 0;
  7. char xCordLength;
  8. char yCordLength;
  9. int xCordLengthInt = 0;
  10. int yCordLengthInt = 0;
  11. void setup()
  12.  
  13. {
  14.   pinMode(5, OUTPUT);
  15.   Serial.begin(9600);
  16. }
  17. void loop()
  18. {
  19.   while(Serial.available()) {
  20.     character = Serial.read();
  21.     content.concat(character);
  22.   }
  23.   // myChar = Serial.read();
  24.   if (character == 'c') // first varible saying to connect
  25.   {
  26.     Serial.write('4'); // just saying it's connected
  27.   }
  28.   else if (character == 'x' && motorControl == 1)
  29.   {
  30.     Serial.write('3');// saying it's ready for new input
  31.   }
  32.   if (character = 'x' && motorControl ==1) {
  33.   xCordLenght = Serial.read();
  34.   delay(20);
  35.   xCordLengthInt = xCordLength.toInt();
  36.   xCord = Serial.read(xCordLengthInt);
  37.   while(Serial.available()) {
  38.     character = Serial.read();
  39.     content.concat(character);
  40.   }
  41.   }
  42.   if (character && motorControl ==1) {
  43.     Serial.write('4');
  44.   }
  45.   yCordLenght = Serial.read();
  46.   delay(20);
  47.   yCordLengthInt = yCordLength.toInt();
  48.   yCord = Serial.read(yCordLengthInt);
  49.   character = 0;
  50.   content = 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement