Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <CanSatKit.h>
- using namespace CanSatKit;
- #define L_POT A0
- #define R_POT A1
- bool led_state = false;
- const int led_pin = 13;
- Radio radio(Pins::Radio::ChipSelect,
- Pins::Radio::DIO0,
- 433.0,
- Bandwidth_125000_Hz,
- SpreadingFactor_7,
- CodingRate_4_8);
- byte motVal[2] = { 0x00 , 0x00 };
- void setup() {
- SerialUSB.begin(115200);
- pinMode(led_pin, OUTPUT);
- pinMode(L_POT, INPUT);
- pinMode(R_POT, INPUT);
- radio.begin();
- }
- void loop() {
- if (radio.tx_fifo_empty())
- {
- digitalWrite(led_pin, led_state);
- led_state = !led_state;
- motVal[0] = (byte)(analogRead(L_POT) / 4);
- motVal[1] = (byte)(analogRead(R_POT) / 4);
- radio.transmit(motVal, 2);
- SerialUSB.println(String(motVal[0]) + " " + String(motVal[1]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement