This follows on from the LDR’s example.


Light Dependent Resistor

Were using the same circuit as before. In this example we will learn how to interact with your GCDuino from your computer using the Arduino IDE’s serial Monitor.


Once you have uploaded the program to your GCDuino, open up the Serial Monitor by clicking the magnifying glass icon on the right side of the Arduino toolbar or pushing “Control + Shift + M”. A new window should open and if the baud rate setting at the bottom is set to 9600, you will begin to see your GCDuino reporting back to you.

In this code the print statement writes characters across the screen while the println statement writes the characters then begins a new line.

This becomes very useful in being able to see the actual data read from the input devices.


We could now use that data with high accuracy. For example, you get a value of 340 when your finger is about 1cm away from the LDR. You could then tell the program to turn the LED on if it’s less than this value.

The great thing about serial communication is that it’s two way. Lets have a look at controlling the LEDs from the computer.


This time we left out the “{” & “}” brackets from the if statements. The code will only run the next line if the condition is true.

From your serial monitor you can now control the LEDs by sending upper and lower case A’s and Z’s.

Leave a Reply

Your email address will not be published. Required fields are marked *