Forum Replies Created
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
simon_schvartzmanParticipant
Definitely 5 V.
Good luck with your project.
simon_schvartzmanParticipantHi, for those who need help with this subject
CODE FOR THE UNO SENDING DATA TO THE BACKPACK
/* Simple sketch to demostrate how to send data from an Arduino Uno to the nootropic RGB Matrix backpack This is the code on the Uno Side The program will do the following: - send a command (Blue Square) - wait 5 secs - send a command to clear the display (Clear) Connections UNO BackPack FTDI Connector Pin 10 (Rx) Pin # 2 (near the +5V terminal) Pin 11 (Tx) Pin # 3 Ground Pin # 6 (right most pin near the Power Jack) */ #include <SoftwareSerial.h> // we will use a soft serial #define Serial_baud_rate 9600 // Comm speed between the boards #define serial_Rxd 10 // Rx to be connected to Tx on the backpack #define serial_Txd 11 // Tx to be connected to Rx on the backpack SoftwareSerial BP_serial(serial_Rxd, serial_Txd); //Define the soft serial String inputString = ""; // a string to hold incoming data void setup() { Serial.begin (9600); //open main Serial port Serial.println ("start"); BP_serial.begin(Serial_baud_rate); // Open the serial port to connect to the backpack } void loop() { BP_serial.print ("Blue Square"); //Backpack will display a Blue Square BP_serial.print (char(10)); //line has to be terminated with line feed (/n) delay (7000); BP_serial.print ("Clear"); //Backpack will clear the matrix BP_serial.print (char(10)); delay (2000); SerialRead (); //Read feedback (echo) from backpack } /* Read the Serial connection */ void SerialRead() { while (BP_serial.available()) { // get the new byte: char inChar = (char)BP_serial.read(); // add it to the inputString: inputString += inChar; if (inChar == '\n') // end of line received { Serial.println (inputString); inputString = ""; //clean up for next reading } } }
CODE FOR THE BACKPACK
// Simple sketch (BackPack) to show how to receive commands from an Arduino Uno // with the nootropic RGB BackPack. // Before connecting to the Uno you can test the program by sending // the commands using the IDE Serial Monitor. Just remember to set it up // // Writen by Simon Schvartzman // based on: // testshapes demo for Adafruit RGBmatrixPanel library. // Demonstrates the drawing abilities of the RGBmatrixPanel library. // For 32x32 RGB LED matrix: // http://www.adafruit.com/products/607 // Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon // for Adafruit Industries. // BSD license, all text above must be included in any redistribution. // Connections // UNO BackPack FTDI Connector // Pin 10 (Rx) Pin # 2 (near the +5V terminal) // Pin 11 (Tx) Pin # 3 // Ground Pin # 6 (right most pin near the Power Jack) #include <Adafruit_GFX.h> // Core graphics library #include <RGBmatrixPanel.h> // Hardware-specific library #define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega) #define OE 9 #define LAT 10 #define A A0 #define B A1 #define C A2 #define D A3 RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false); String inputString = ""; // a string to hold incoming data boolean stringComplete = false; // flag to mark the string is complete void setup() { Serial.begin (9600); matrix.begin(); } void loop() { //Serial.println ("Hello World"); // print the string when a newline arrives: if (stringComplete == true) { Serial.println(inputString); //read the command and act accordingly if (inputString == "Blue Square") { BlueSquare (); } if (inputString == "Clear") { clearMatrix (); } // clear the string: inputString = ""; stringComplete = false; } delay (5000); //inputString = ""; //serialRead(); } void BlueSquare () { //fill in a rectangle in blue for (int i = 10; i < 22; i = i + 1) { for (int j = 10; j < 22; j = j + 1) { matrix.drawPixel(i, j, matrix.Color333(0, 0, 7)); delay (15); } } } void clearMatrix() { // fill the screen with 'black' matrix.fillScreen(matrix.Color333(0, 0, 0)); } /* SerialEvent occurs whenever a new data comes in the hardware serial RX. This routine is run between each time loop() runs, so using delay inside loop can delay response. Multiple bytes of data may be available. */ void serialEvent() { while (Serial.available()) { // get the new byte: char inChar = (char)Serial.read(); if (inChar == '\n') { // if the incoming character is a newline, set a flag // so the main loop can do something about it: stringComplete = true; } else { // add it to the inputString: inputString += inChar; } } }
simon_schvartzmanParticipantThanks Michael, that’s very useful.
Regards
simon_schvartzmanParticipantHi team, I would like to connect the backpack to an Arduino Yun.
Ideally I would like to use the Yun’s USB port connected to an FTDI cable on the backpack.
Any ideas?
Many thanks in advance
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)