source: trunk/arduino/puzzlebox_brainstorms_wheelchair_noisebridge/puzzlebox_brainstorms_wheelchair_noisebridge.pde

Last change on this file was 240, checked in by sc, 9 years ago

puzzlebox_brainstorms_wheelchair_noisebridge.pde:

  • relocated to necessary location for ide

trunk/brainstorms/Puzzlebox/Brainstorms/Wheelchair_Control.py:

  • object model adopted

trunk/brainstorms/Puzzlebox/Brainstorms/Helicopter_Control.py:

  • whitespace cleanup
File size: 2.8 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  display_values();
47 
48}
49
50void display_values() {
51 
52  Serial.print('x');
53
54  if (h == true)
55    Serial.print("1");
56  else
57    Serial.print("0");
58
59  if (a == true)
60    Serial.print("1");
61  else
62    Serial.print("0");
63
64  if (b == true)
65    Serial.print("1");
66  else
67    Serial.print("0");
68
69  if (c == true)
70    Serial.print("1");
71  else
72    Serial.print("0");
73
74  if (d == true)
75    Serial.print("1");
76  else
77    Serial.print("0");
78
79  if (e == true)
80    Serial.print("1");
81  else
82    Serial.print("0");
83
84  if (f == true)
85    Serial.print("1");
86  else
87    Serial.print("0");
88
89  if (g == true)
90    Serial.print("1");
91  else
92    Serial.print("0");
93 
94  Serial.println();
95}
96
97void loop() {
98  //if (led == true) {
99  //  led = false;
100  //} else {
101  //  led = true;
102  //}
103  //digitalWrite(13,led);
104  digitalWrite(10,a);
105  digitalWrite(2,b);
106  digitalWrite(3,c);
107  digitalWrite(4,d);
108  digitalWrite(5,e);
109  digitalWrite(6,f);
110  digitalWrite(7,g);
111  digitalWrite(8,h); 
112  while (Serial.available() == 0); // pause until a byte is received by serial Rx
113  inByte = Serial.read();
114  if (inByte == 'x') {
115      while (Serial.available() == 0);
116      inByte = Serial.read();
117      h = (inByte =='1');
118      while (Serial.available() == 0);
119      inByte = Serial.read();
120      g = (inByte =='1');
121      while (Serial.available() == 0);
122      inByte = Serial.read();
123      f = (inByte =='1');
124      while (Serial.available() == 0);
125      inByte = Serial.read();
126      e = (inByte =='1');
127      while (Serial.available() == 0);
128      inByte = Serial.read();
129      d = (inByte =='1');
130      while (Serial.available() == 0);
131      inByte = Serial.read();
132      c = (inByte =='1');
133      while (Serial.available() == 0);
134      inByte = Serial.read();
135      b = (inByte =='1');
136      while (Serial.available() == 0);
137      inByte = Serial.read();
138      a = (inByte =='1');
139  }
140
141  display_values(); 
142  //Serial.println(char(a),char(b),char(c),char(d),char(e),char(f),char(g),char(h));
143  //Serial.println(a, b, c, d, e, f, g ,h);
144
145}
146
Note: See TracBrowser for help on using the repository browser.