Basic Arduino Programming

The goal of this lab was to demonstrate using input and output with Arduino.

breadBoard

In one circuit I used a button as the input and an LED as an output so that the button could be used to turn the LED on. To do this I had to use a pull-down resistor so that the light would turn off when the button was no longer pushed. You can view this circuit in action in the video below.

After this I decided to try something a little more complicated by implementing a button in my final project circuit. In this circuit the input devices were a button and a temperature sensor and the outputs were a water pump and the arduino serial monitor.

circuit

In the code I utilized a conditional statement.

code1

I then also tried controlling the pump with a for loop that utilized the modulus operator.

code2