If you haven't already, download all of the Arduino code (sketch to program your Qduino Mini board) for all of the projects below:
Move the files to your desktop, and double click on the Circuit 2 - ButtonLED.ino sketch to get started. The Arduino IDE should open up, with the code inside, which should look like the photo below:
Click Tools > Boards > Qduino Mini.
Then click Tools > Port > /dev/cu.usbmodemXXXX where XXXX is any string of numbers - make sure that it is not anything similar to /dev/cu.Bluetooth
Hit the right arrow at the upper-left hand corner of your screen, to upload the program to your Qduino Mini!
Set up the circuit below on your breadboard (the white colored rectangle with small holes to place components into) -
Click the button on your breadboard, and watch the LED turn on! - if you have any problems, please comment below. Lets go over the code in depth -
First - we include the libraries for the Qduino, and Wire - which controls the battery fuel gauge. A library is hundreds of lines of code that are bare bones level usually, so that you have an easier time of coding! - they're really easy to use.
Next, we make a variable - an object that stores a value. In this case, we are saying that the integer ledPin, is equal to D13, which is where the blue pin of the RGB LED is connected to. Then, we setup the Qduino Library - by saying "qduino q;" <- notice the semicolon - mostly every line of code except for #include statements, void setup() & void loop() need a semicolon.
In the setup loop, which runs one time, to setup the pins, we declare D13 as an output (outputs are LEDs and motors, inputs are sensors). Then we turn the LED on with digitalWrite when the button state is "HIGH", and off when the button state is "LOW"
Comments