Assignment 11 - Input Devices
I learned a lot during this assignment.
First I tried different mechanisms to play with a sequences of LEDs or a counter. I also understood better the way the connections worked.
Step 1. Program the board. First I connect each of the components of the ISP (MISO, MOSI, VCC, etc) of the Arduino with the ones in my board.
Step 2. Set-up the protoboard.
In this assignment I worked with a light sensor. Light sensors work very similar to a switch that will reset a system.
1. The way I understand it is the following:
The energy is always flowing through a system and you have to program the ATTINY when the energy stops flowing so it performs something that you want.
2. Therefore you connect the VCC with a resistor, the resistor with the sensor and the other side of the sensor with the ground. In the same connection where the resistor and the sensor are close together you connect it to the Arduino.
3. The idea is that your circuit will always have energy or always be under a state of "1" until the light is low. When the light is low the program will detect it and then you can condition it to make something. In my case, I asked to light-up a LED.
DIFFICULTIES:
1. I got confused between the entrances of my board. I added some additional entrances so I could connect easier INPUTS and OUTPUTS.
2. I thought that the entrance was corresponding to the port 10 and it was to the port 0. As you can see in the picture, I do not connect directly on the Attiny but to a line with 7 holes which is an extension of my Attiny. When I designed it I did the following -->
1st hole --> 13th pin in the Attiny --> Port 0
2nd hole --> 12th pin in the Attiny -->Port 1
3rd hole --> 6th pin in the Attiny -->Port 7
4th hole --> 5th pin in the Attiny -->Port 8 (connected to LED)
5th hole --> 11th pin in the Attiny -->Port 2
6th hole --> 10th pin in the Attiny -->Port 3
7th hole --> 2th pin in the Attiny -->Port 10
3. There were some strange delays between my board perceiving dark and the LED lightning up. I think this my be because my clock is not working well.
Important:
Set-up the board, port, etc. correctly in the program of Arduino:
1. Tools -->Board -->Attiny
2. Tools --> Processor -->
Attiny84
3. Tools -->Clock -->20 MHZ
4. Tools -->Port-->Arduino/Genuino
5. Tools _>Programmer -->
Arduino as ISP
MY MAC didn't have these options so I worked in windows with another computer
Programming and Conditional (if, if else)
What I did was to create a variable named VAR1 that will get the value of 1 when the light sensor receives light and 0 otherwise.
Then using this variable I program a led that will light-up whenever the sensor does not receives light.