source: trunk/brainstorms/arduino/puzzlebox_brainstorms_wheelchair_noisebridge.pde @ 236

Last change on this file since 236 was 236, checked in by sc, 11 years ago

brainstorms/arduino/puzzlebox_brainstorms_wheelchair_noisebridge.pde:

  • initial checkin
File size: 2.2 KB
Line 
1boolean a=true;
2boolean b=true;
3boolean c=false;
4boolean d=false;
5boolean e=true;
6boolean f=true;
7boolean g=false;
8boolean h=false;
9
10boolean led=false;
11
12char inByte=0;
13
14void setup() {               
15  // initialize the digital pin as an output.
16  // Pin 13 has an LED connected on most Arduino boards:
17  pinMode(13, OUTPUT);
18  pinMode(10, OUTPUT);
19  pinMode(2, OUTPUT);
20  pinMode(3, OUTPUT);
21  pinMode(4, OUTPUT);
22  pinMode(5, OUTPUT);
23  pinMode(6, OUTPUT);
24  pinMode(7, OUTPUT);
25  pinMode(8, OUTPUT);
26
27//  digitalWrite(13,HIGH);
28//  delay(250);
29//  digitalWrite(13,LOW);
30//  delay(250);
31//  digitalWrite(13,HIGH);
32//  delay(250);
33//  digitalWrite(13,LOW);
34
35  Serial.begin(9600);
36
37  digitalWrite(10,a);
38  digitalWrite(2,b);
39  digitalWrite(3,c);
40  digitalWrite(4,d);
41  digitalWrite(5,e);
42  digitalWrite(6,f);
43  digitalWrite(7,g);
44  digitalWrite(8,h); 
45 
46  Serial.println('x');
47 
48}
49
50void loop() {
51  //if (led == true) {
52  //  led = false;
53  //} else {
54  //  led = true;
55  //}
56  //digitalWrite(13,led);
57  digitalWrite(10,a);
58  digitalWrite(2,b);
59  digitalWrite(3,c);
60  digitalWrite(4,d);
61  digitalWrite(5,e);
62  digitalWrite(6,f);
63  digitalWrite(7,g);
64  digitalWrite(8,h); 
65  while (Serial.available() == 0); // pause until a byte is received by serial Rx
66  inByte = Serial.read();
67  if (inByte == 'x') {
68      while (Serial.available() == 0);
69      inByte = Serial.read();
70      h = (inByte =='1');
71      while (Serial.available() == 0);
72      inByte = Serial.read();
73      g = (inByte =='1');
74      while (Serial.available() == 0);
75      inByte = Serial.read();
76      f = (inByte =='1');
77      while (Serial.available() == 0);
78      inByte = Serial.read();
79      e = (inByte =='1');
80      while (Serial.available() == 0);
81      inByte = Serial.read();
82      d = (inByte =='1');
83      while (Serial.available() == 0);
84      inByte = Serial.read();
85      c = (inByte =='1');
86      while (Serial.available() == 0);
87      inByte = Serial.read();
88      b = (inByte =='1');
89      while (Serial.available() == 0);
90      inByte = Serial.read();
91      a = (inByte =='1');
92  }
93 
94  //Serial.println(char(a),char(b),char(c),char(d),char(e),char(f),char(g),char(h));
95  //Serial.println(a, b, c, d, e, f, g ,h);
96
97}
98
Note: See TracBrowser for help on using the repository browser.