a32u4_interface.cpp 734 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "a32u4_interface.h"
  2. HardwareSerial MySerial_two(2);
  3. void A32u4Interface::begin() {
  4. MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
  5. Serial.println("Setup A32U4 Serial Interface");
  6. this->initTime = millis();
  7. }
  8. void A32u4Interface::runScript(String script) {
  9. MySerial_two.println(script);
  10. }
  11. void A32u4Interface::test() {
  12. MySerial_two.println("STRING Hello, World!");
  13. }
  14. void A32u4Interface::main(uint32_t current_time) {
  15. if (current_time - this->initTime >= 1000) {
  16. this->initTime = millis();
  17. //MySerial_two.write("PING");
  18. //delay(1);
  19. if (MySerial_two.available()) {
  20. Serial.println("Got A32U4 Serial data");
  21. Serial.println(MySerial_two.read());
  22. }
  23. }
  24. //delay(1);*/
  25. }