Skip to content

Instantly share code, notes, and snippets.

@katsuyoshi
Last active April 13, 2023 14:20
Embed
What would you like to do?
LoRaモジュール評価ボード E220-900T22S(JP)-EV1を使ったLoRa通信受信側 M5AtomLite使用
#include <Arduino.h>
#include <M5Unified.h>
#define LORA_M0_PIN 21
#define LORA_M1_PIN 25
#define LORA_RX_PIN 23
#define LORA_TX_PIN 19
void setLoraMode(int mode) {
pinMode(LORA_M0_PIN, OUTPUT);
pinMode(LORA_M1_PIN, OUTPUT);
digitalWrite(LORA_M0_PIN, mode & 0x1 != 0);
digitalWrite(LORA_M1_PIN, mode & 0x2 != 0);
}
void setup() {
M5.begin();
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, LORA_RX_PIN, LORA_TX_PIN);
setLoraMode(0);
delay(1000);
}
void loop() {
if (Serial2.available()) {
int ch = Serial2.read();
Serial.write(ch);
}
delay(10);
}
[env:m5stack-atom]
platform = espressif32
board = m5stack-atom
framework = arduino
monitor_speed = 115200
lib_deps =
m5stack/M5Unified@^0.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment