Last active
April 13, 2023 14:20
-
-
Save katsuyoshi/d261703e01527fe5c0a7244d2a16bab6 to your computer and use it in GitHub Desktop.
LoRaモジュール評価ボード E220-900T22S(JP)-EV1を使ったLoRa通信受信側 M5AtomLite使用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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