Hallo zusammen,
da Tommy mir eine große Hilfe geleistet hat und nun der Sender läuft, braucht es natürlich jetzt noch einen Empfänger, der die Signale auswertet.
Kurz zur Funktion die es haben soll:
Empfangen werden wieder die Zahl 0 oder 1.
Bei 1 => Darstellen von Text1 z. B. Frei.
Bei 0 => Darstellen von Text2 z. B. Besetzt.
und das ganze wieder von vorn. Hintergrund: 0 und 1 werden mit Hilfe eines Lichtsensores an das Bluetooth Modul gesendet.
Im Internet habe ich einen Sketch für mich abgewandelt, es zeigt aber keinen Text an. Was genau läuft hier falsch? Ich muss ja den Text sicherlich als [ ] schreiben.. Sprich wenn =='1' wird, zeige [Text1] an.. oder?
/*
8x8 LED Matrix MAX7219 Scrolling Text
Android Control via Bluetooth
by Dejan Nedelkovski, www.HowToMechatronics.com
Based on the following library:
GitHub | riyas-org/max7219 https://github.com/riyas-org/max7219
*/
#include <MaxMatrix.h>
#include <SoftwareSerial.h>
#include <avr/pgmspace.h>
PROGMEM const unsigned char CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
};
int dIn = 11; // DIN pin of MAX7219 module
int clk = 13; // CLK pin of MAX7219 module
int cs = 10; // CS pin of MAX7219 module
int maxInUse = 4; // Number of MAX7219's connected
MaxMatrix m(dIn, cs, clk, maxInUse);
SoftwareSerial Bluetooth(8, 7); // Bluetooth
byte buffer[10];
char incomebyte;
char text[100] = " "; // Initial text message
int count = 0;
char indicator;
void setup() {
m.init(); // MAX7219 initialization
Bluetooth.begin(9600); // Default communication rate of the Bluetooth module
}
void loop() {
// Printing the text
if (Bluetooth.available()) { // Checks whether data is comming from the serial port
indicator = Bluetooth.read(); // Starts reading the serial port, the first byte from the incoming data
if (indicator == '1') {
text[count] = "Frei";
}