MEGA2560 Microcontroller Learning - Kit
1. TABLE OF CONTENT ME 1. 2. 3. 4. 5. 6. 7. Table of content General information Software installation Resistors Lessons 1. Lesson : Hello World 2. Lesson : Flashing LED 3. Lesson : PWM light control 4. Lesson : Traffic light 5. Lesson : LED hunting effect 6. Lesson : Key-controlled LED 7. Lesson : Responder experiment 8. Lesson : Active buzzer 9. Lesson : Passive buzzer 10. Lesson : Reading the analog value 11. Lesson : Photo resistor 12. Lesson : Flame sensor 13. Lesson : Tilt sensor 14.
1. GENERAL INFORMATION Dear customer, Thank you very much for choosing our product. In the following, we will show you what has to be observed during commissioning and use. Should you encounter any unexpected problems during use, please feel free to contact us. Technical data Our board is a high-quality replica and compatible to the Arduino Mega 2560 but it is explicitly not an original Arduino.
Pin assignment USB-B-Port Voltage regulator ICSP for USB AREF IOREF Reset GND PWM Interface Power supply Analog Inputs TXO RXO Communication interface Digital I/O Pins www.joy-it.net Pascalstr.
3. SOFTWARE INSTALLATION In order to start programming the Joy-IT ard_Mega2560R3, a development environment and the drivers for the corresponding operating system must first be installed on the computer. The Arduino IDE (which you can download here), which is available as an OpenSource software under the GPLv2 and published by the Arduino manufacturer. It is aimed at beginners from concept and structure.
4. RESISTORS In this set there are three different resistors 220 Ω, 1 kΩ and 10 kΩ. On resistors there is a colour coding which can be used to calculate or detect the resistance if it cannot be measured with a multimeter. In this chapter you will learn how to calculate this resistance in order to better perform the following lessons, because you need to be able to identify the different resistances in order to correctly reproduce the setups.
If we now look at our resistances, we cann quickly calculate their value. Let's start with the 220 Ω resistance 5. Ring (Tolerance): Brown : 1 % 1. Ring: Red : 2 2. Ring: Red : 2 3. Ring: Black : 0 4. Ring (Multiplier): Black : - Due to the fact that the multiplier has no value, the resistance can be determined on 220 Ω with a tolerance of 1%, which this resistance can vary. 5. Ring (Tolerance): Brown: 1 % 1. Ring: Brown: 1 2. Ring: Black : 0 3. Ring: Black : 0 4.
5. LESSONS Lesson 1 : Hello world We start with something simple. For this project you only need the board and a USB cable to start the lesson. This is a communication test for your Mega2560 and your PC, and a basic project for your first try in the Arduino world! Once the installation of the drivers is complete, open the Arduino software and write a code that will allow the Mega2560 to display Hello World! under your instructions.
Click on the serial monitor and add R , then the LED on the board will light up and your PC will receive the information Hello World! from the Arduino. Lesson 2: Flashing LED In the Hello World! program we have already encountered the LED. This time we will connect an LED with one of the digital pins. The following parts are needed: 1x Mega2560 board 1x USB cable 1x Red M5 LED 1x 220 Ω resistor 1x Breadboard 2x Jumper cable www.joy-it.net Pascalstr.
We follow the following wiring diagram. Here we use the digital pin 10. We connect the LED with a 220 Ω resistor to avoid damage due to excessive current. www.joy-it.net Pascalstr.
int ledPin = 10; // defines Digital Pin 10. void setup() { pinMode(ledPin, OUTPUT); // defines pin to output } void loop() { digitalWrite(ledPin, HIGH); // turns on led delay(1000); // waits a second digitalWrite(ledPin, LOW); // turns off led delay(1000); // waits a second } After uploading the program you will se the LED which is connected to pin 10 , light up every second.
There are many applications for PWM: regulation of lamp brightness, regulation of motor speed, etc. . These are the three basic parameters of PWM: Width Height 1. The amplitude of the pulse width (minimum / maximum) The pulse period (The mutual pulse rate in one second) The voltage level (like: 0 - 5 V) 2. 3. Cycle There are 6 PWM interfaces on the Mega2560: digital pins 3, 5, 6, 9, 10 and 11.
The input of the potentiometer is analog, so we connect it to the analog port. We connect the LED to the PWM port. A other PWM signal can regulate the brightness of the LED. www.joy-it.net Pascalstr.
In this experiment read the analog valuePin of the int potpin = 0; we // will Initialises analog 0 potentiometer and assign the value to the PWM port, so that a corresponding change in the int ledpinof= the 11;LED // can Initialises digital (PWMthe Output) brightness be observed. We will Pin also 11 display analog int val // Saves the Sensors Value value on = the0; screen. void setup() { pinMode(ledpin,OUTPUT); // defines digital Pin 11 to „Output“ Serial.
1x Green M5 LED 3x 220 Ω resistor 1x Breadboard 4x Jumper cable www.joy-it.net Pascalstr.
Since this is a situation of traffic lights, the lighting time of each individual LED should be exactly the same as in a real traffic light. In this program we will use the Arduino delay function to control the delay time.
6x M5 LED 6x 220 Ω resistor 1x Breadboard 13x Jumper cable www.joy-it.net Pascalstr.
int BASE = 2 ; // The I/O pin for the first LED int NUM = 6; // Amount of LEDs void setup() { for (int i = BASE; i < (BASE + NUM); i ++) { pinMode(i, OUTPUT); // Set I/O pins as output } } void loop() { for (int i = BASE; i < (BASE + NUM); i ++){ digitalWrite(i, LOW); // Sets I/O pins to "low" // switches on the LEDs one after the other delay(200); // delay } for (int i = BASE; i < (BASE + NUM); i ++) { digitalWrite(i, HIGH); // Sets I/O pins to "high" // switches off the LEDs one after the other delay(200
Lesson 6: Key-controlled LED I/O-Port is an interface, which can be used as input and output. So far, we've only used it as the output. In this experiment we will try to use the input to read the output value of the connected device. We will use a key as input and a LED as output to get a better understanding of the I/O functions.Key switches, which many people probably know, have a switching value (digital value). When the switch is pressed, the circuit closes and is in a conducting state.
10 kΩ 220 Ω int BASE = 2 ; // I/O Pin for the first LED int NUM = 6; // Amount of LEDs void setup() { for (int i = BASE; i < (BASE + NUM); i ++) { pinMode(i, OUTPUT); // Sets I/O Pins to output } } void loop() { for (int i = BASE; i < (BASE + NUM); i ++) { digitalWrite(i, LOW); // Set I/O Pin to „low“ // turns on leds one by one delay(200); // delay } for (int i = BASE; i < (BASE + NUM); i ++) { digitalWrite(i, HIGH); // Sets I/O Pin to „high“ // turns off led one by one delay(200); // delay } } When the
Lesson 7: Responder experiment In this lesson there are three button switches and a reset button, which control the 3 corresponding LEDs by means of 7 digital I/O pins. For this you need: 1x Mega2560 board 1x USB cable 7x 220 Ω Widerstand 1x Red M5 LED 1x Yellow M5 LED 1x Green M5 LED 4x Key switch 1x Breadboard 13x Jumper cable www.joy-it.net Pascalstr.
int int int int int int int int int int redled=8; // Pin for red LED yellowled=7; // Pin for yellow LED greenled=6; // Pin for green LED redpin=5; // Pin for red key yellowpin=4; // Pin for yellow key greenpin=3; // Pin for green key restpin=2; // Pin for reset pin red; yellow; green; void setup() { pinMode(redled,OUTPUT); pinMode(yellowled,OUTPUT); pinMode(greenled,OUTPUT); pinMode(redpin,INPUT); pinMode(yellowpin,INPUT); pinMode(greenpin,INPUT); } www.joy-it.net Pascalstr.
void loop(){ //Repeatedly reads the pins of the keys red = digitalRead(redpin); yellow = digitalRead(yellowpin); green = digitalRead(greenpin); if(red==LOW)RED_YES(); if(yellow==LOW)YELLOW_YES(); if(green==LOW)GREEN_YES(); } void RED_YES(){// Executes the code until red LED is on // ends the cycle when the reset button is pressed while(digitalRead(restpin)==1){ digitalWrite(redled,HIGH); digitalWrite(greenled,LOW); digitalWrite(yellowled,LOW); } clear_led(); } void YELLOW_YES(){// Executes the code until ye
Make sure you add both pieces of code in your sketch to the Arduino IDE. When a button is pressed, the corresponding LED is switched on. When the reset button is pressed, the corresponding LED is switched off again. Lesson 8: Active buzzer Active buzzers are used in computers, printers, alarm clocks, electric toys etc. as a noise-emitting element. It has an internal vibration source. When connected to a 5V power supply, it can buzz repeatedly.
int buzzer=8; // Initialize digital I/O pin, which controls the buzzer void setup() { pinMode(buzzer,OUTPUT); // set pin as "output" } void loop() { digitalWrite(buzzer, HIGH); // makes noises } The project is completed after the transfer of the program. If the buzzer is supplied with power after the transfer, it will be making noises. www.joy-it.net Pascalstr.
Lesson 9: Passive buzzer With the Mega2560 many interactive projects are possible. The previous projects have mainly dealt with LEDs, but a frequently used project is the acoustic-optical display. For this a passive buzzer is used, which, in contrast to the active buzzer, cannot activate itself. The activation is done by a pulse frequency. Different frequencies result in different tones of the buzzer. This can be used, for example, to reproduce the melody of a song.
int buzzer=8; // I/O pin for buzzer void setup() { pinMode(buzzer,OUTPUT); // sets pin as output } void loop() { unsigned char i,j; // defines variable while(1){ for(i=0;i<80;i++) { // makes frequency sound digitalWrite(buzzer,HIGH); // sound delay(1); // 1ms delay digitalWrite(buzzer,LOW); // no sound delay(1); // 1ms delay } for(i=0;i<100;i++) { // makes frequency sound digitalWrite(buzzer,HIGH); // sound digitalWrite(buzzer,LOW); // no sound delay(2); // 2ms delay } } } www.joy-it.net Pascalstr.
Lesson 10: Reading the analog value This project deals with the analog interfaces of the Mega2560. An analogRead() command can read the value of the interface. Due to the analog-to-digital conversion of the Mega2560 the read values are between 0 and 1023. To be able to read out the values, it is important to ensure the correct baud rate (here: 9600). The baud rate of the computer should correspond to the baud rate of the device.
int potpin=0; // sets pin for potentiometer to analog 0 int ledpin=13; // sets pin for led for pin 13 int val=0; // defines val void setup() { pinMode(ledpin,OUTPUT); // sets led pin as output Serial.begin(9600); // sets baudrate to 9600 } void loop() { digitalWrite(ledpin,HIGH); // turns led on pin 13 on delay(50); // waits 0.05 seconds digitalWrite(ledpin,LOW); // turns led on pin 13 off delay(500); // waits 0.05 seconds val=analogRead(potpin); // reads analog value and assigns it to val Serial.
Lesson 11: Photo resistor A photoresistor is a resistor whose resistance varies depending on the incident light intensity. It is based on the photoelectric effect of semiconductors. When the incident light is intense, the resistivity is reduced. If the incident light is weak, the resistance increases. Photo r esistors are normally used for light measurement, light control and photovoltaic conversion (converting the change of light into a change of electricity).
10 kΩ 220 Ω int potpin=0; // Initialises analog Pin 0 int ledpin=11; // Initialises digital Pin 11 // output which regulates the led brightness int val=0; // Initialises Variable „Val“ void setup() { pinMode(ledpin,OUTPUT); // Set Pin 11 to output Serial.begin(9600); // Set Baudrate to „9600“ } void loop() { val=analogRead(potpin); // reads the sensors values and assigns it to val Serial.
Lesson 12: Flame sensor The flame sensor (infrared receiving triode) is specially designed for robots used to find sources of flame. This sensor has a high sensitivity to flames. The flame sensor is built on the principle that infrared radiation is very sensitive to fire. It has a specially designed infrared pick-up tube to detect fire, then to convert the brightness of the flame into a signal to convert. These signals are then sent to the central processor and processed accordingly.
int flame=0; // analog pin 0 for sensor int Beep=9; // digital pin 9 for buzzer int val=0; // defines variable val void setup() { pinMode(Beep,OUTPUT); // sets buzzer pin as output pinMode(flame,INPUT); // sets sensor pin as input Serial.begin(9600); // sets baudrate to 9600 } void loop() { val=analogRead(flame); // reads the analog values of sensor Serial.
Lesson 13: Tilt sensor In this lesson, the tilt sensor acts as an on/off switch for an LED. The LED is on when one end of the sensor is below the horizontal position. Using the analog interface to which the tilt sensor is connected, you can check the position of the sensor. For this lesson you need: 1x Mega2560 board 1x USB cable 1x Red M5 LED 1x 220 Ω resistor 1x Breadboard 5x Jumper cable 1x Tilt sensor 1x 10 kΩ resistor www.joy-it.net Pascalstr.
10 kΩ 220 Ω void setup() { pinMode(8,OUTPUT); // sets pin 8 as output } void loop() { int i; // defines variable i while(1) { i=analogRead(5);// reads voltage value from pin 5 if(i>512) { // if bigger than 512 (2.5 V) digitalWrite(8,LOW); // switch LED on } else { digitalWrite(8,HIGH); // switch LED off } } } www.joy-it.net Pascalstr.
Lesson 14: 1-digit LED segment display LED segment displays are widely used for displaying numerical information. They are often used for displays of electromagnetic ovens, fully automatic washing machines, water temperature displays, electronic watches, etc. The LED segment display is a semiconductor and light emitting device. Its basic unit is an LED. Depending on the wiring of the LED units, the LED segment display can be divided into displays with common anode and displays with common cathode.
www.joy-it.net Pascalstr.
// sets I/O pin for every segment int a=7; // sets pin 7 for segments a int b=6; // sets pin 6 for segments b int c=5; // sets pin 5 for segments c int d=10; // sets pin 10 for segments d int e=11; // sets pin 11 for segments e int f=8; // sets pin 8 for segments f int g=9; // sets pin 9 for segments g int dp=4; // sets pin 4 for segments dp void digital_0(void) { // shows number 0 unsigned char j; digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e,HIGH);
void digital_3(void) { // shows number 3 digitalWrite(g,HIGH); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(dp,LOW); digitalWrite(f,LOW); digitalWrite(e,LOW); } void digital_4(void) { // shows number 4 digitalWrite(c,HIGH); digitalWrite(b,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); digitalWrite(dp,LOW); digitalWrite(a,LOW); digitalWrite(e,LOW); digitalWrite(d,LOW); } void digital_5(void) { // shows number 5 unsigned char j; digitalWrite(a,HIGH);
void digital_7(void) { // shows number 7 unsigned char j; for(j=5;j<=7;j++) digitalWrite(j,HIGH); digitalWrite(dp,LOW); for(j=8;j<=11;j++) digitalWrite(j,LOW); } void digital_8(void) { // shows number 8 unsigned char j; for(j=5;j<=11;j++) digitalWrite(j,HIGH); digitalWrite(dp,LOW); } void digital_9(void) { // shows number 9 unsigned char j; digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e, LOW); digitalWrite(f,HIGH); digitalWrite(g,HIGH); digitalWrite(dp
delay(1000); digital_5(); delay(1000); digital_6(); delay(1000); digital_7(); delay(1000); digital_8(); delay(1000); digital_9(); delay(1000); // // // // // // // // // // // waits shows waits shows waits shows waits shows waits shows waits 1 second number 5 1 second number 6 1 second number 7 1 second number 8 1 second number 9 1 second } } Lesson 15: 4-digits LED segment display In this project a 4-digit 7-segment display is operated. Current limiting resistors are indispensable for LED displays.
// pins for anode int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; int dp = 8; // pins for cathode int d4 = 9; int d3 = 10; int d2 = 11; int d1 = 12; // sets variables long n = 1230; int x = 100; int del = 55; www.joy-it.net Pascalstr.
void setup() { pinMode(d1, OUTPUT); pinMode(d2, OUTPUT); pinMode(d3, OUTPUT); pinMode(d4, OUTPUT); pinMode(a, OUTPUT); pinMode(b, OUTPUT); pinMode(c, OUTPUT); pinMode(d, OUTPUT); pinMode(e, OUTPUT); pinMode(f, OUTPUT); pinMode(g, OUTPUT); pinMode(dp, OUTPUT); } void loop() { Display(1, Display(2, Display(3, Display(4, } 1); 2); 3); 4); void position(unsigned char n){ switch(n) { case 1: digitalWrite(d1,LOW); digitalWrite(d2, HIGH); digitalWrite(d3, HIGH); digitalWrite(d4, HIGH); break; case 2: digitalWrit
case 4: digitalWrite(d1, digitalWrite(d2, digitalWrite(d3, digitalWrite(d4, break; default : digitalWrite(d1, digitalWrite(d2, digitalWrite(d3, digitalWrite(d4, break; HIGH); HIGH); HIGH); LOW); HIGH); HIGH); HIGH); HIGH); } } void Num_0() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, LOW); digitalWrite(dp,LOW); } void Num_1() { digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH);
void Num_3() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, HIGH); digitalWrite(dp,LOW); } void Num_4() { digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); digitalWrite(dp,LOW); } void Num_5() { digitalWrite(a, HIGH); digitalWrite(b, LOW); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrit
void Num_7() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); digitalWrite(dp,LOW); } void Num_8() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); digitalWrite(dp,LOW); } void Num_9() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWr
void pickNumber(unsigned char n) { // chooses number switch(n) { case 0: Num_0(); break; case 1: Num_1(); break; case 2: Num_2(); break; case 3: Num_3(); break; case 4: Num_4(); break; case 5: Num_5(); break; case 6: Num_6(); break; case 7: Num_7(); break; case 8: Num_8(); break; case 9: Num_9(); break; default: Clear(); break; } } void Display(unsigned char x, unsigned char Number) { position(x); pickNumber(Number); delay(1); Clear() ; // clears display } www.joy-it.net Pascalstr.
If the above code is transferred completely to the Mega2560, the display shows 1234. Lektion 16: LM35 temperature sensor The LM35 is a popular and easy to use temperature sensor. No other hardware is needed. The only difficulty is to write the code that converts the analog values that it reads into Celsius. You need: 1x Mega2560 board 1x USB cable 1x LM35 1x Breadboard 5x Jumper cable www.joy-it.net Pascalstr.
int potPin = 0; // sets sensor to ananlog pin 0 void setup() { Serial.begin(9600); // sets baudrate to 9600 } void loop() { int val; // defines variable val int dat; // defines variable dat val=analogRead(0); // reads the analog value from sensor dat=(125*val)>>8; // Temperature calculation formula Serial.print("Temp:"); // output begins with Temp: Serial.print(dat); // prints the calculated temperature Serial.println(" *C"); // dispalys "*C" delay(500); // waits 0.
Lektion 17: 74HC595 Shift register The 74HC595 is a combination of an 8-digit shift register and flags. It is equipped with a tri-state output. In this project the 74HC595 is used to use 8 LEDs to save resources. The required I/O ports are reduced from 8 to 3 ports. You need: 1x Mega2560 board 1x USB cable 4x Red M5 LED 8x 220 Ω resistor 1x Breadboard 24x Jumper cable 4x Green M5 LED 1x 75HC595 Chip www.joy-it.net Pascalstr.
int data = 2; // sets pin 14 as data pin int clock = 5; // sets pin 11 as clock pin int latch = 4; // sets pin 12 as output int ledState = 0; const int ON = HIGH; const int OFF = LOW; void setup() { pinMode(data, OUTPUT); pinMode(clock, OUTPUT); pinMode(latch, OUTPUT); } void loop() { for(int i = 0; i < 256; i++) { updateLEDs(i); delay(500); } } www.joy-it.net Pascalstr.
void updateLEDs(int value) { digitalWrite(latch, LOW); shiftOut(data, clock, MSBFIRST, ~value); digitalWrite(latch, HIGH); // Interlock } Lesson 18: RGB-LED This diode is controlled by PWM signals and has a three-color system for displaying colors. The component can be connected directly to the Mega2560 interfaces. It is required: 1x Mega2560 board 1x USB cable 1x RGB-LED 1x Breadboard 5x Jumper cable 3x 220 Ω resistor www.joy-it.net Pascalstr.
int int int int redpin = 11; // sets pin 11 for red LED bluepin =10; // sets pin 10 for blue LED greenpin =9; // sets pin 9 for green LED val; void setup() { pinMode(redpin, OUTPUT); pinMode(bluepin, OUTPUT); pinMode(greenpin, OUTPUT); Serial.begin(9600); } void loop() { for(val=255; val>0; val--) { analogWrite(11, val); analogWrite(10, 255-val); analogWrite(9, 128-val); delay(1); } for(val=0; val<255; val++) { analogWrite(11, val); analogWrite(10, 255-val); analogWrite(9, 128-val); delay(1); } Serial.
Lesson 19: Infrared remote control The IR receiver converts the incoming light signal into a weak electrical signal. To decode the code of a remote control, it is necessary to know the coding method. In this project the NEC protocol is used for this purpose. For this you need: 1x Mega2560 Platine 1x USB-Kabel 6x M5 LED 6x 220 Ω Widerstand 1x Breadboard 11x Überbrückungskabel 1x Infrarot-Empfänger 1x Infrarot-Fernbedienung www.joy-it.net Pascalstr.
The following code requires the library IRremote which you can download in the Arduino IDE at Sketch → Include Library → Manage libraries… . There you can manage the libraries you have created using the search bar to find and install this library. Restart your IDE afterwards. The following code will receive a signal via infrared, decode and output to the serial monitor. If you use the supplied remote control, the pressed button on the remote control will also be outputted correctly.
long on2 = 0x00FF629D; long off2 = 0x00FFA857; long on3 = 0x00FFE21D; long off3 = 0x00FF906F; long on4 = 0x00FF22DD; long off4 = 0x00FF6897; long on5 = 0x00FF02FD; long off5 = 0x00FF9867; long on6 = 0x00FFC23D; long off6 = 0x00FFB04F; IRrecv irrecv(RECV_PIN); decode_results results; void dump(decode_results *results) { int count = results->rawlen; if (results->decode_type == UNKNOWN){ Serial.println("Could not decode message"); } else { if (results->decode_type == NEC){ Serial.
else if(results->value == 0xFFC23D) Serial.println("Button: >>"); else if(results->value == 0xFFE01F) Serial.println("Button: EQ"); else if(results->value == 0xFFA857) Serial.println("Button: -"); else if(results->value == 0xFF906F) Serial.println("Button: +"); else if(results->value == 0xFF6897) Serial.println("Button: 0"); else if(results->value == 0xFF9867) Serial.println("Button: Reload"); else if(results->value == 0xFFB04F) Serial.println("Button: U/SD"); else if(results->value == 0xFF30CF) Serial.
int on = 0; unsigned long last = millis(); void loop() { if (irrecv.decode(&results)){ if (millis() - last > 250){ on = !on; // digitalWrite(8, on ? HIGH : LOW); digitalWrite(13, on ? HIGH : LOW); dump(&results); } if (results.value == on1 ) digitalWrite(LED1, HIGH); if (results.value == off1 ) digitalWrite(LED1, LOW); if (results.value == on2 ) digitalWrite(LED2, HIGH); if (results.value == off2 ) digitalWrite(LED2, LOW); if (results.value == on3 ) digitalWrite(LED3, HIGH); if (results.
Lesson 20: 8x8 LED-Matrix The 8 x 8 LED matrix consists of 64 LEDs. Each LED is placed at the intersection of row and column. If the level for a row is 1 and the level of the corresponding column is 0, the LED will turn on at its intersection. Example: If you want to switch on the first LED, set pin 9 to "HIGHLEVEL" and pin 13 to "LOWLEVEL". If you want to switch on the first row, set pin 9 to "HIGHLEVEL" and pins 13, 3, 4, 10, 11, 15 and 16 to "LOWLEVEL".
Make sure that the LED matrix is connected properly. Under the matrix there is a bulge (picture) where you can compare the position of your matrix with the matrix on the picture.
void setup(){ int i = 0 ; for(i=2;i<18;i++) { pinMode(i, OUTPUT); } clear_(); } void loop() { show_num(); } void clear_(void) { // clears screen for(int i=2;i<10;i++) digitalWrite(i, LOW); for(int i=0;i<8;i++) digitalWrite(i+10, HIGH); } www.joy-it.net Pascalstr.
6. OTHER INFORMATION PR Our information and take-back obligations according to the Electrical and Electronic Equipment Act (ElektroG) Symbol on electrical and electronic equipment: This crossed-out dustbin means that electrical and electronic appliances do not belong in the household waste. You must return the old appliances to a collection point. Before handing over waste batteries and accumulators that are not enclosed by waste equipment must be separated from it.