Magic Button!
Home BUY HERE

IoT Project: The Magic Button!



Code Breakdown

int

This sections used to setup variables, usually used to indicate which modules are connected to each pin. In this casde, the touch sensor is on pin 2, and the LED on pin 13, as seen below.

void setup()

This section is used to configure the previously configured pins, whether they should be used as an input or an output.

void loop()

This is where the code that runs on the microcomputer is stored, and unless stated will run indefinetly, constantly.

IF and ELSE statements

These snippets of code constant run a check to see if there is an input being recieved from The touch sesnor. If the response is a positive ( or a 1) the microcomputer will send a signal to the LED, causing it to light. If that response then returns negative (or a 0), a LED will be turnned off.