-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRS485TestServer.cpp
More file actions
35 lines (30 loc) · 870 Bytes
/
Copy pathRS485TestServer.cpp
File metadata and controls
35 lines (30 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// https://forum.arduino.cc/t/serial-input-basics-updated/382007/3
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "Constants.h"
uint64_t timing = micros();
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
// Set up OLED display
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
// Start Serial
Serial.begin(115200);
// Set ENABLE High to enable transmission
pinMode(ENABLE_PIN,OUTPUT);
digitalWrite(ENABLE_PIN,HIGH);
}
void loop() {
// Send number
timing = micros();
Serial.printf("!%llu@",timing);
// Display current number
display.clearDisplay();
display.setCursor(0, 0);
display.printf("Count:%llu",timing);
display.display();
}