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 <SPI.h> | |
| #include "SSD1306Ascii.h" | |
| #include "SSD1306AsciiSoftSpi.h" | |
| // pin definitions | |
| #define MOSI 11 | |
| #define DC 12 | |
| #define SCK 13 | |
| #define CS 14 |
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 <U8g2lib.h> | |
| #include <SPI.h> | |
| #define MOSI 11 | |
| #define DC 9 | |
| #define SCK 13 | |
| #define CS 10 | |
| #define SAMPLE_TIME 1000 // 1 second = 1000 ms |
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 <U8g2lib.h> | |
| #include <SPI.h> | |
| #define MOSI 11 | |
| #define DC 9 | |
| #define SCK 13 | |
| #define CS 14 |
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 <Wire.h> | |
| #include "MMC5883.h" | |
| MMC5883MA MMC5883(Wire); | |
| void setup() { | |
| Serial.begin (115200); | |
| Serial.println ("\nMMC5883MA Magnetometer Demo Sketch"); | |
| Wire.begin(); |
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 <Wire.h> | |
| #define MMC5883MA_ADDR 0x30 | |
| #define MMC5883MA_ID_REG 0x2F | |
| #define MMC5883MA_ID 0x0C | |
| void setup() { | |
| Serial.begin (115200); | |
| Serial.println ("\nMMC5883MA Magnetometer Check Sketch"); |
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
| void armESC() { | |
| delay(3000); | |
| ESC1.writeMicroseconds(QUARTER_PULSEWIDTH); | |
| ESC2.writeMicroseconds(QUARTER_PULSEWIDTH); | |
| ESC3.writeMicroseconds(QUARTER_PULSEWIDTH); | |
| ESC4.writeMicroseconds(QUARTER_PULSEWIDTH); | |
| delay(2000); | |
| ESC1.writeMicroseconds(MIN_PULSEWIDTH); | |
| ESC2.writeMicroseconds(MIN_PULSEWIDTH); | |
| ESC3.writeMicroseconds(MIN_PULSEWIDTH); |
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
| 1. /****************************************************************** | |
| 2. @file MotorDriver.ino | |
| 3. @brief Drive two bi-directional motors using a H-bridge | |
| 4. ******************************************************************/ | |
| 5. | |
| 6. #define M1_ENABLE 3 | |
| 7. #define M1_INPUT1 2 | |
| 8. #define M1_INPUT2 4 | |
| 9. | |
| 10. #define M2_ENABLE 11 |
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
| // MSP_DEBUGMSG Packet contents | |
| struct msp_debug_msg_t { | |
| char msg[32]; | |
| } __attribute__ ((packed)); |
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
| size_t structSize = sizeof(debug32); | |
| strncpy(debug32.msg, "Payload Rx: ", 13); | |
| strcat(debug32.msg, (const char*)payload); | |
| msp.response(MSP_DEBUGMSG, &debug32, structSize); |
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
| // read payload | |
| uint8_t * payloadPtr = (uint8_t*)payload; | |
| uint8_t idx = 0; | |
| while (idx < *recvSize) { | |
| if (millis() - t0 >= _timeout) | |
| return false; | |
| if (_stream->available() > 0) { | |
| uint8_t b = _stream->read(); | |
| checksumCalc ^= b; | |
| if (idx < maxSize) |