Advertisement
Midge

Arduino Sketch for Windows Phone to Python to Arduino Test

Oct 31st, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Receive a Byte from Serial and push it to Port B
  2. /* controlling pins on a port via Serial */
  3.  
  4. char incomingByte = 0; // character for incoming serial data
  5.  
  6.  
  7. void setup() {
  8. Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
  9. DDRB= B00111111; //Set Port B as output (Pins 8 to 13) The two MSB pins are for Xtal and unusable
  10. }
  11.  
  12. void loop() {
  13.  
  14. // Listen for incoming Serial data:
  15. if (Serial.available() > 0) {
  16. // read the incoming byte:
  17. incomingByte = Serial.read();//Read from Serial Port
  18. PORTB=incomingByte; //output data to Port B
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement