0

Kratak Arduino tečaj: LED 8x8 programiranje

8. lesson

Ovo je dio cjelovitog tečaja Arduino-a.
  1. Štampajte dijelove koristeći ovaj SketchUp model: RescueLine.zip.
  2. Sastavite robota koristeći upute za sastavljanje.
  3. Spojite kablove koristeći plan spajanja.
  4. Programirajte robota.
    1. Osnove.
    2. Praćenje crte.
    3. Naredbe.
    4. LIDARi.
    5. Prekidač, IMU, 8x8 LED.
    6. Praćenje zida.
    7. Srebro.
    8. 8x8 LED programiranje (ova stranica).
    9. Robotska ruka.
    10. Raspberry Pi.
    11. Prepoznavanje kamerom, OpenCV.
    12. Arduino i RPI surađuju.

LED 8x8

Make sure You have ML-R Displays library version 0.2 or higher. You can download it from https://www.github.com/PribaNosati/MRMS. Displays.ino, included in the library, is listed here. Connect the display and study the code.

#include <i2c_t3.h>
#include "Displays.h"

Displays displays;

//Definition of bitmaps. 1s will be turn on the LEDs.
static const uint8_t PROGMEM
BITMAP1[] =
{
  B00011000,
  B00111100,
  B01111110,
  B11111111,
  B00000000,
  B00000000,
  B00000000,
  B00000000
},
BITMAP2[] = {
  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00111100,
  B00111100,
  B00111100,
  B00111100
};

void setup()
{
  Wire.begin();
  Serial.begin(115200);

  displays.add(0x70); //Add a display using I2C address 0x70

  // Display a character (S) using the default color (green).
  displays.displayChar(0, 'S');
  delay(1000);
  // Do the same, but specify color: red.
  displays.displayChar(0, 'S', LED_RED);
  delay(1000);

  // This command clears the display.
  displays.clear(0);
  delay(500);

  // Draw the bitmap defined above and immidiately display it.
  displays.drawBitmap(0, 0, 0, BITMAP1, 8, 8, LED_YELLOW, true);
  delay(1000);

  // Combine 2 bitmaps
  displays.drawBitmap(0, 0, 0, BITMAP2);
  displays.drawBitmap(0, 0, 0, BITMAP1, 8, 8, LED_RED);
  displays.writeDisplay(0); // Now, display them both
  delay(1000);

  // Scroll letters.
  displays.test(0);
}

void loop(){}

/**All the ML-R libraries invoke this function when something goes wrong. Here we stop the motors, display the error
message which enters the function as the only argument ("message") and then enter an endless loop. while(1) never ends as the condition
(1) is always true. The only command that is in the loop is ";" (empty command - does nothing).
@param message*/
void error(String message){
  Serial.println(message);
  while(1);
}
Previous lesson
Next lesson