Skip to content

Commit ab642ac

Browse files
author
lenardgeorge
committed
Modified examples and projects
1 parent b73126f commit ab642ac

File tree

23 files changed

+93
-118
lines changed

23 files changed

+93
-118
lines changed

Examples/Lessons/L6_SendingDataToTheBoard/L6_Activity3/L6_Activity3.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ void setup()
2424
{
2525
guessingWord[i] = '_';
2626
}
27+
Serial.print("The Word you are looking for is: ");
28+
Serial.println(guessingWord);
2729
}
2830

2931
void loop()
@@ -54,7 +56,7 @@ void loop()
5456
}
5557

5658
// printing the state of the guess word
57-
else if (mistakes < chances)
59+
if (mistakes < chances)
5860
{
5961
Serial.print("The Word you are looking for is: ");
6062
for (int i = 0; i < sizeof(selectedWord); i++)

Examples/Lessons/L7_AnalogInputs/L7_Activity3/L7_Activity3.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88

99
int USsensor = A0;
10-
int redLED = 13;
11-
int yellowLED = 12;
12-
int greenLED = 11;
10+
int yellowLED = 9;
11+
int redLED = 11;
12+
int greenLED = 13;
1313

1414
float distance = 0;
1515
int value = 0;

Examples/Lessons/L8_AnalogOutputs/L8_Activity2/L8_Activity2.ino

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,45 @@
77
*/
88

99
//pin connections
10-
int buttonC = 13;
10+
int buttonA = 13;
1111
int buttonB = 12;
12-
int buttonA = 11;
1312
int piezo = 8;
1413

1514
// notes frequency
16-
int C_note = 262;
15+
int A_note = 262;
1716
int B_note = 493;
18-
int A_note = 440;
1917

2018
// to save the button states
21-
int buttCvalue = 0;
22-
int buttBvalue = 0;
2319
int buttAvalue = 0;
20+
int buttBvalue = 0;
2421

2522
void setup()
2623
{
27-
pinMode(buttonC, INPUT);
28-
pinMode(buttonB, INPUT);
2924
pinMode(buttonA, INPUT);
25+
pinMode(buttonB, INPUT);
3026
pinMode(piezo, OUTPUT);
3127
}
3228

3329
void loop()
3430
{
3531
//reading the buttons states
36-
buttCvalue = digitalRead(buttonC);
37-
buttBvalue = digitalRead(buttonB);
3832
buttAvalue = digitalRead(buttonA);
33+
buttBvalue = digitalRead(buttonB);
3934

4035
// play a note, based on the button pressed
41-
if (buttCvalue == HIGH)
36+
if (buttAvalue == HIGH)
4237
{
43-
tone (piezo, C_note);
38+
tone (piezo, A_note);
4439
}
4540
else if (buttBvalue == HIGH)
4641
{
4742
tone (piezo, B_note);
4843
}
49-
else if (buttAvalue == HIGH)
50-
{
51-
tone (piezo, A_note);
52-
}
5344
else
5445
{
5546
noTone(piezo);
5647
}
5748
}
49+
50+
51+

Examples/Projects/P1_FingerRace/P1_FingerRace_Stage2/P1_FingerRace_Stage2.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void loop() {
2929
{
3030
digitalWrite(greenLED_P1, LOW);
3131
}
32-
//STEP2; to check if button_P2 & greenLED_P2 works
32+
3333
if ( digitalRead(_____) == _____)
3434
{
3535
digitalWrite(_____,_____);

Examples/Projects/P1_FingerRace/P1_FingerRace_Stage3/P1_FingerRace_Stage3.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ int greenLED_P2 = 9;
1111
int button_P1 = 6;
1212
int button_P2 = 7;
1313

14-
//STEP 3; Variables for both the blue LEDs
1514
int blueLED_P1 = 12;
1615
int blueLED_P2 = 10;
1716

18-
//STEP 3; Variable for the gameState
1917
int gameState = 0;
2018

2119
void setup()
@@ -31,10 +29,9 @@ void setup()
3129

3230
void loop()
3331
{
34-
//STEP3; game state programming for Waiting Mode
35-
if (gameState == 0)
32+
33+
if (gameState == _____)
3634
{
37-
//STEP3; Blink all the LEDs
3835
digitalWrite(greenLED_P1, _____);
3936
digitalWrite(blueLED_P1, _____);
4037
digitalWrite(blueLED_P2, _____);
@@ -46,12 +43,10 @@ void loop()
4643
digitalWrite(greenLED_P2, _____);
4744
delay(200);
4845
}
49-
//STEP3; game state programming for Countdown mode
5046
else if (gameState == 1)
5147
{
5248

5349
}
54-
//STEP3; game state programming for Play mode
5550
else if (gameState == 2)
5651
{
5752

Examples/Projects/P1_FingerRace/P1_FingerRace_Stage6/P1_FingerRace_Stage6.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,18 @@ void loop()
137137
}
138138
digitalWrite(greenLED_P1, HIGH);
139139

140-
if (previousButtonState_P1 == HIGH)
140+
if (previousButtonState_P1 == LOW)
141141
{
142142
player_1 = player_1 + 1;
143143
}
144-
previousButtonState_P1 = LOW;
144+
previousButtonState_P1 = HIGH;
145145
}
146146

147147
else
148148
{
149149

150150
digitalWrite(greenLED_P1, LOW);
151-
previousButtonState_P1 = HIGH;
151+
previousButtonState_P1 = LOW;
152152
}
153153

154154
if ( digitalRead(button_P2) == HIGH)
@@ -159,15 +159,15 @@ void loop()
159159
}
160160

161161
digitalWrite(greenLED_P2, HIGH);
162-
if (previousButtonState_P2 == HIGH)
162+
if (previousButtonState_P2 == LOW)
163163
{
164164
player_2 = player_2 + 1;
165165
}
166-
previousButtonState_P2 = LOW;
166+
previousButtonState_P2 = HIGH;
167167
}
168168
else
169169
{
170170
digitalWrite(greenLED_P2, LOW);
171-
previousButtonState_P2 = HIGH;
171+
previousButtonState_P2 = LOW;
172172
}
173173
}

Examples/Projects/P1_PinBall/P1_Pinball_Stage1/P1_Pinball_Stage1.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ int blueLED_2 = 12;
1010
int redLED = 13;
1111
int greenLED = 9;
1212

13-
void setup() {
13+
void setup()
14+
{
1415
pinMode (blueLED_1, _____);
1516
pinMode (blueLED_2, _____);
1617
pinMode (redLED, _____);
@@ -24,9 +25,9 @@ void loop()
2425
digitalWrite(redLED,_____);
2526
digitalWrite(greenLED,_____);
2627
delay(1000);
27-
digitalWrite(blueLED_1, HIGH);
28-
digitalWrite(blueLED_2,HIGH);
29-
digitalWrite(redLED,HIGH);
30-
digitalWrite(greenLED,HIGH);
28+
digitalWrite(blueLED_1, LOW);
29+
digitalWrite(blueLED_2,LOW);
30+
digitalWrite(redLED,LOW);
31+
digitalWrite(greenLED,LOW);
3132
delay(1000);
3233
}

Examples/Projects/P1_PinBall/P1_Pinball_Stage2/P1_Pinball_Stage2.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ void loop() {
3131
digitalWrite(blueLED_2,HIGH);
3232
digitalWrite(redLED,HIGH);
3333
digitalWrite(greenLED,HIGH);
34-
delay(200);
35-
digitalWrite(blueLED_1, HIGH);
36-
digitalWrite(blueLED_2,HIGH);
37-
digitalWrite(redLED,HIGH);
38-
digitalWrite(greenLED,HIGH);
39-
delay(200);
34+
delay(1000);
35+
digitalWrite(blueLED_1, LOW);
36+
digitalWrite(blueLED_2,LOW);
37+
digitalWrite(redLED,LOW);
38+
digitalWrite(greenLED,LOW);
39+
delay(1000);
4040
*/
4141

4242
if ( digitalRead(button_1) == _____)

Examples/Projects/P1_PinBall/P1_Pinball_Stage3/P1_Pinball_Stage3.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ void setup()
2727

2828
void loop() {
2929

30-
if ( digitalRead(button_1))
30+
if ( digitalRead(button_1) == HIGH )
3131
{
3232
digitalWrite(greenLED, HIGH);
3333
winning = _____;
3434
delay(_____);
3535
}
3636

37-
if ( digitalRead(button_2) )
37+
if ( digitalRead(button_2) == HIGH )
3838
{
3939
digitalWrite(blueLED_1, HIGH);
4040
losing = _____;

Examples/Projects/P1_PinBall/P1_Pinball_Stage4/P1_Pinball_Stage4.ino

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ void setup()
2929
void loop() {
3030

3131

32-
if ( digitalRead(button_1))
32+
if ( digitalRead(button_1) == HIGH )
3333
{
3434
winning = 1;
3535
delay(2000);
3636
}
3737

38-
if ( digitalRead(button_2) )
38+
if ( digitalRead(button_2) == HIGH )
3939
{
4040
losing = losing + 1;
4141
delay(2000);
@@ -55,39 +55,39 @@ void loop() {
5555
delay(1000);
5656
}
5757

58-
else if (losing == 1) {
58+
else if (losing == 1)
59+
{
5960
digitalWrite(_____, _____);
60-
61+
delay(1500);
6162
}
6263
else if (losing == 2)
6364
{
6465
digitalWrite(_____, _____);
66+
delay(1500);
6567
}
6668
else if (losing == 3)
6769
{
6870
digitalWrite(redLED, HIGH);
6971
digitalWrite(greenLED, LOW);
7072
delay(_____);
71-
digitalWrite(blueLED_1, LOW);
72-
digitalWrite(blueLED_2, LOW);
73-
digitalWrite(redLED, LOW);
73+
digitalWrite(blueLED_1, _____);
74+
digitalWrite(blueLED_2, _____);
75+
digitalWrite(redLED, _____);
7476
delay(_____);
75-
digitalWrite(blueLED_1, HIGH);
76-
digitalWrite(blueLED_2, HIGH);
77-
digitalWrite(redLED, HIGH);
77+
digitalWrite(blueLED_1, _____);
78+
digitalWrite(blueLED_2, _____);
79+
digitalWrite(redLED, _____);
7880
delay(_____);
79-
digitalWrite(blueLED_1, LOW);
80-
digitalWrite(blueLED_2, LOW);
81-
digitalWrite(redLED, LOW);
81+
digitalWrite(blueLED_1, _____);
82+
digitalWrite(blueLED_2,_____);
83+
digitalWrite(redLED, _____);
8284
delay(_____);
83-
digitalWrite(blueLED_1, HIGH);
84-
digitalWrite(blueLED_2, HIGH);
85-
digitalWrite(redLED, HIGH);
85+
digitalWrite(blueLED_1, _____);
86+
digitalWrite(blueLED_2, _____);
87+
digitalWrite(redLED, _____);
8688
delay(_____);
8789

8890
losing = _____;
8991
winning = _____;
9092
}
91-
92-
delay(500);
9393
}

0 commit comments

Comments
 (0)