We ended up spending and entire lesson trying to display our work. Eman and I had to look at the wirings and got a brief explanation of how the positive/live socket and ground worked. Since power supply cables were limited we had to figure out how to wire all our arduinos in such a way to maximise the use of the cables. Solutions involved reprogramming our boards (Amira and Amreen)…it was either that or soldering forked wires. Reprogramming was a simple step of changing the (7-y) in a single line of code.
They didn’t sync as perfectly as we had imagined. The reason was that we all had different numbers of frames. However, the imperfection grew on us. The concept of the dancefloor was enhanced when Wall.e would dance with Abu or when Eve would dance with the Genie, instead of their proper partners.
The second lesson was fun. We got a refresher of high school physics and the concepts of sensors. We moved on from working with Rainbowduinos to working with Arduinos. This involved looking more at the circuitry and the effect of programming the hardware on the readings and outputs. We revisited concepts like using the serial monitor to see how the code was being read.
Arduino – has input and output (input sensor or other info – can be analogue or digital, output light/movement/other action – again can be analogue or digital:
input > arduino > output -led (light)
-sensors -servo (movement)
-button -motor (movement)
-touch -speaker (sound)
-sound -screen (visual)
The best part? This look at the arduino would be Interactive!
Circuit – if it’s not complete, then nothing will work
The basic idea was that there were 13 digital pins? And that we could program the pins directly, for example: ‘turn on pin 13’
^ every single one pin is 5V and can be controlled directly.
Something to remember is that of those pins, 6 were analog pins? (the ones with ~ next to them). This meant that sensors could be attached to them, and it could be programmed with instructions like: ‘analog IN’…It related to the concept of a pwm – pule width modulation. We could use code like:
analogeWrite(pin, value) – to send a virtual analogue signal. (pwm?)
Instead of working independently, we all worked together on a first experiment:
We learnt how to light up an LED. Long one in 5v, short one in ground, this needed a resistor since too much current can result in burnouts.
resistance is key to circuits – restrict amount of energy to prevent burnout
V = IR
I = V/R
R = V/I
Like how we programmed our Rainbowduinos, we have to set the pinMode in the setup – only need to write it once. We used the main Arduino website as a reference again:
pinMode (pin, mode);
pin – pin number
modes – input, output, input_pullup
high = on
low = off
I/O – input output
pinnacle of our learning – randomly blinking lights
Next lesson we really looked at how to read analogue readings (from an input). We ended the previous lesson trying to unsuccessfully do this. The problem was simply reading the pin as
A0 instead of just 0:
power (+5v) >> photoresistor (control amount of flow) > gnd
^ Personally I didn’t get this concept. How could we see if our code works or not without a physical output? Turns out we use the serial monitor as an output.
>> > A0 input (act like another gnd)
We learnt the details of how printing worked. Serial print will print a character in a continuous line:
current = constrain(current,0,9)
^ constraining readings from raw readings of 0-1023 to a desired range (1-10 or 0-8 or 0-5…you get the idea) allows us to set an output for a specific range. Say the reading is small, then the fan will go slow (pretend I put a fan as an output). The speed of the fan will go up on the scale of 0-5. The thing with these numbers is that they could be used to play frames as well, frames 0-8, depending on which reading is being sensed…
The homework was to read chapters in the Arduino book about these concepts, to help us learn more about circuits.