I'm working on a project where I have a remote arduino sending 2 temperature values and humidity to a master arduino. The data needs to be in the form of t1.t1, HU, t2.t2 Unfortunately, the examples that come with the Manchester.h library show how an array is sent/received but don't really give any examples on how to send the type of data I'm trying to send. My assumption is that I need to convert these numbers to a string and send the data as 72.34, 34, 74.34 (The numbers are just as an example). I need to be able to return this data to numbers I can actually use on the receiving end, and not just a string. Can someone, anyone, show me what code I would use to do this? I'm including the basic manchester.h array code. I just need someone to show me what code I need to add to make this work on the transmit and receiver end code. I'm seriously at the point of major frustration with this and have run out of options.
Transmit Code:
#include <Manchester.h>
/*
Manchester Transmitter example
In this example transmitter will send 10 bytes array per transmittion
try different speeds using this constants, your maximum possible speed will
depend on various factors like transmitter type, distance, microcontroller speed, ...MAN_300 0
MAN_600 1
MAN_1200 2
MAN_2400 3
MAN_4800 4
MAN_9600 5
MAN_19200 6
MAN_38400 7*/
#define TX_PIN 5 //pin where your transmitter is connected
#define LED_PIN 13 //pin for blinking LEDuint8_t moo = 1; //last led status
uint8_t data[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, moo);
man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
man.setupTransmit(TX_PIN, MAN_1200);
}void loop() {
man.transmitArray(10, data);
moo = ++moo % 2;
digitalWrite(LED_PIN, moo);
}
Receive Code:
#include <Manchester.h>
/*
Manchester Transmitter example
In this example transmitter will send 10 bytes array per transmittion
try different speeds using this constants, your maximum possible speed will
depend on various factors like transmitter type, distance, microcontroller speed, ...MAN_300 0
MAN_600 1
MAN_1200 2
MAN_2400 3
MAN_4800 4
MAN_9600 5
MAN_19200 6
MAN_38400 7*/
#define TX_PIN 5 //pin where your transmitter is connected
#define LED_PIN 13 //pin for blinking LEDuint8_t moo = 1; //last led status
uint8_t data[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, moo);
man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
man.setupTransmit(TX_PIN, MAN_1200);
}void loop() {
man.transmitArray(10, data);
moo = ++moo % 2;
digitalWrite(LED_PIN, moo);
}