Skip to content

Commit 20c1814

Browse files
committed
Fixed issue in Starter kit example number 4
1 parent 4672d45 commit 20c1814

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

build/shared/examples/10.StarterKit/p04_ColorMixingLamp/p04_ColorMixingLamp.ino

+17-16
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
three 10 kilohm resistors
1111
3 220 ohm resistors
1212
3 photoresistors
13-
red green aand blue colored gels
13+
red green and blue colored gels
1414
1515
Created 13 September 2012
16+
Modified 14 November 2012
1617
by Scott Fitzgerald
1718
Thanks to Federico Vanzati for improvements
1819
@@ -42,42 +43,42 @@ void setup() {
4243
Serial.begin(9600);
4344

4445
// set the digital pins as outputs
45-
pinMode(greenLedPin,OUTPUT);
46-
pinMode(redLedPin,OUTPUT);
47-
pinMode(blueLedPin,OUTPUT);
46+
pinMode(greenLEDPin,OUTPUT);
47+
pinMode(redLEDPin,OUTPUT);
48+
pinMode(blueLEDPin,OUTPUT);
4849
}
4950

5051
void loop() {
5152
// Read the sensors first:
5253

5354
// read the value from the red-filtered photoresistor:
54-
redsensorValue = analogRead(redsensorPin);
55+
redSensorValue = analogRead(redSensorPin);
5556
// give the ADC a moment to settle
5657
delay(5);
5758
// read the value from the green-filtered photoresistor:
58-
greensensorValue = analogRead(greensensorPin);
59+
greenSensorValue = analogRead(greenSensorPin);
5960
// give the ADC a moment to settle
6061
delay(5);
6162
// read the value from the blue-filtered photoresistor:
62-
bluesensorValue = analogRead(bluesensorPin);
63+
blueSensorValue = analogRead(blueSensorPin);
6364

6465
// print out the values to the serial monitor
6566
Serial.print("raw sensor Values \t red: ");
66-
Serial.print(redsensorValue);
67+
Serial.print(redSensorValue);
6768
Serial.print("\t green: ");
68-
Serial.print(greensensorValue);
69+
Serial.print(greenSensorValue);
6970
Serial.print("\t Blue: ");
70-
Serial.println(bluesensorValue);
71+
Serial.println(blueSensorValue);
7172

7273
/*
7374
In order to use the values from the sensor for the LED,
7475
you need to do some math. The ADC provides a 10-bit number,
7576
but analogWrite() uses 8 bits. You'll want to divide your
7677
sensor readings by 4 to keep them in range of the output.
7778
*/
78-
redValue = redsensorValue/4;
79-
greenValue = greensensorValue/4;
80-
blueValue = bluesensorValue/4;
79+
redValue = redSensorValue/4;
80+
greenValue = greenSensorValue/4;
81+
blueValue = blueSensorValue/4;
8182

8283
// print out the mapped values
8384
Serial.print("Mapped sensor Values \t red: ");
@@ -90,8 +91,8 @@ void loop() {
9091
/*
9192
Now that you have a usable value, it's time to PWM the LED.
9293
*/
93-
analogWrite(redLedPin, redValue);
94-
analogWrite(greenLedPin, greenValue);
95-
analogWrite(blueLedPin, blueValue);
94+
analogWrite(redLEDPin, redValue);
95+
analogWrite(greenLEDPin, greenValue);
96+
analogWrite(blueLEDPin, blueValue);
9697
}
9798

0 commit comments

Comments
 (0)