Ok, also der Sender hat jetzt keinen SoftwareSerial.h mehr. Habe ich gelöscht.
Am Empfänger gibt mir der Monitor aber wieder kein x0 aus.. sondern entweder 0 und 1. (Je nach dem, ob der Sensor bedeckt ist, oder nicht)...
Code ist folgender:
/*
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(1, 0); // 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();
while (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
Serial.print(" 0x");
Serial.println(indicator,HEX);
if (indicator == '1') Serial.println("Frei");
else Serial.println("Besetzt");
}
}}