Make sure that you follow all of the Qtechknow Creator Kit projects in order! - they progressively teach you more complicated skills. To start on the first project, click here: https://www.hackster.io/qtechknow/creator-kit-project-1-blink
Open up the Arduino IDE with the Circuit 3 - LightSensor.ino sketch, 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) -
Open the Serial monitor (this lets us see incoming data from the Arduino on the computer), by clicking the hour glass in the upper right hand corner of the IDE.
Put your hand over the light sensor to see the numbers change! - 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.
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. Next, we make a variable - an object that stores a value. In this case, we are declaring sensorValue, which we will use to store how much light is in the room.
In the setup loop, which runs one time, to setup the pins, we setup Serial communication, and wait for the Serial monitor to be opened. Then, in the loop, we assign the sensorValue variable to the pin A0, where we connected the light sensor. Then, we adjust the values from 32 -> 930 to 0 -> 100 to make it easier to read. The value is then printed on the Serial port, and delayed to not use too much battery power.
Comments