Arduino + Processing Workshop

Arduino

3B Green and Yellow LED alternate

3B.mp4

In the previous assignment, we connected one LED (light-emitting diode) to the Arduino. ( mini controller services as a computational system to send tasks onto the breadboard which is the white long piece shown in the picture above with all the small holes. The Arduino gets connected through jumper wires as you see above onto the breadboard. The LEDs have two legs a short one and a long one, the long leg is connected to the positive charge (energy coming in) and the short leg is connected to the negative charge(energy going out). The energy going through the circuit created by connecting all the parts (Arduino, jumping,cabels,LEDS and breadboard) makes it possible for the electricity to turn the LED on. The next step after getting the LEDs to work is to change the code to make them alternate. This is done by alternating the output from low to High, High is when the Led is on and Low when it is off. This is done in the code above with Digital Write, where you can also see that each LED is assigned a pinMode for the output, if these are not declared the code won't be able to recognize the pins, and you will get an error.

4C One LED slowly fades in and the other fades out at the same time.


4C.mp4

The analogWrite makes it possible for the pin, to change in from the brightest 255 to the lowest 0 which is turned of. There is a delay of 0.1 sec before it changes from the green LED to the yellow one. Loops action makes sure the command keeps getting repeated. The LEDs have been assigned to pin 10 and 9 which make it possible to change in brightness between on and off instead of only going on and off like what happens when you have a digital switch.

6C CONTROLLING A LED WITH A POTMETER


VID_20210518_122414.mp4

This exercise used the input from the potentiometer from a previous step to create the "controller" for the LED's the meter was assigned parameters that were linked to the brightness of the LED. This is using the analogue read to see when the potentiometer is reaching the indicated parameters as you see in the code, the intensity of the brightness depends on the value received from the analogue read, for this, you need to have an RGB LED which most are these days. The highest value here is 255 as high as LED can go and lowest 0 anything below 255 and above 0 should result in the LED being turned on, you can try this by turning on the potentiometer. A delay of 0,20 mili sec has been added before transitioning from one brightness measurement to the next,



7A LED MATRIX


The first step is to upload the controller to the library to this you go to tools > manage libraries and then you can search for the LED controller you can click to install it. Each value in the code below is the position indication of the pixels needed to create the "smiley" face.

WhatsApp Video 2021-06-25 at 22.00.58.mp4

If you want to display something in the matrix, you just need to know if the pixel is in a determined row or column, the LEDs that are on or off. By assigning the pixels a number in the code it is possible to create the desired form. A great tool that can be used to practice with the Pixel display is Microbit.org the opensource ( accessible and free for non-commercial use) software that has some fun sketches that make it possible to create a game on the screen or short animation with the matrix using code.

8 Control de LED with light


8.mp4

This sample tests if the sensor is more or less covered that it should react to it light intake to changes in brightness. Com as seen above it the serial monitor screen showing the fluctuation in brightness(energy) when getting the hand closer to the light. You can also see that the com window has been used to see the different values when coming closer or getting further from the LED influencing their brightness.

9 C: Siren- SOUND


9 Siren.mp4

For a siren, the frequency always increases until a certain upper frequency is reached and then the frequency is decreased again. For this, I use a loop to achieve different tones within the code. The tone is defined in the int a= and it takes place by applying voltage, the delay determines how long it will take to transition onto the next tone. For the sound to come out you need a speaker pin that is connected t your bread board and via jumper wires to the Arduino.

11C Distance


11C Distance.mp4

The distance meter can be set to detect the set distance, as result the light will turn on or off very much like the potentiometer in the previous example the output depends on the parameters, in this case, an assigned distance as well as the range of the sensor itself. In this example, you can see that pos indicates position meaning if the position is 80 mm and above 40 mm delay with 10 milliseconds.

Arduino + Processing

12 D This was the first exercise connecting the Arduino to processing

WhatsApp Video 2021-06-25 at 18.37.31 (1).mp4
VID_20210531_160342.mp4

The ellipse has been created to be the trigger on mouse hover, my elipse changes colour but a second action was also added which was the tune of the music will change when entering and exiting the ellipse area. The mouse commands have been set using processing while the setting for the speaker/sound have been set in Arduino with the speaker pin. The "H" and the "L" are identified as low or high which is connected to hover not hover over ellipse.

13 B The LED should turn off while the button is pressed.


VID_20210624_223418.mp4

The input is when the button is pushed, when the button is pushed the LED will go to hight and turn un when pushing again the button will switch of and turn of the LED this is a digital switch as it goes only back and forward between two states ther is no in between in brightness for the LED/

14 B servo move in a funny, rhythmical way



VID_20210624_213714.mp4

The delay has been changed from 5 ms to 10 ms to create a change in speed while the position for the rotator is changed in the definition of a=150; a<1000; a+=10. This is done for each delay.