initial push

This commit is contained in:
2021-03-29 23:48:38 +02:00
parent f7066319be
commit 4ba8332404
6 changed files with 311 additions and 19 deletions

32
examples/ssp/ssp.ino Normal file
View File

@@ -0,0 +1,32 @@
#include <Arduino.h>
#include <SSPDevice.h>
// Define new device
SSPDevice deviceOne;
// Gets called when a complete packet has been received.
void onPacket(Packet packet) {
Serial.println("Received Packet!");
Serial.println(packet.id);
Serial.println(packet.command);
Serial.println(packet.data);
Serial.println("----------------");
// To send a packet
deviceOne.sendPacket("IDPacket", "Commandhere", "testtest");
}
void setup() {
// Initialize (deviceOne) serial device on index 0 with a baud rate of 115200.
deviceOne.init(0, 115200);
}
void loop() {
// Call receive packets function (looping) to handle incoming serial packets.
// If a complete packet has been received it will call the callback function (onPacket).
deviceOne.receivePackets(onPacket);
// Small delay to not over overwork CPU.
delay(1);
}