TinyZero Serial Port Communication

temecom

  • Newbie
  • *
    • Posts: 3
    • View Profile
I just received a tinyZero and went to run a serial port test program that runs on the regular tiny with the serial shield... Nothing. I can't get a character on the port monitor at any baud rate. Can the onboard port be used for Serial communication or do I need to still use a serial port shield?

Simple serial test (LED flashes OK:


#include <ArduinoJson.h>
#include <Ethernet.h>
#include <SPI.h>
#include "tinyGarageDoor.h"

void setup() {
   // Initialize Serial port
  Serial.begin(BAUD_RATE_115200);
  while (!Serial) continue;
  delay(2);
  Serial.print(F("Tiny-Garage Version: "));
  Serial.println(F(VERSION));
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  Serial.println("Checking door... ");
 digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);           
}


temecom

  • Newbie
  • *
    • Posts: 3
    • View Profile
I checked the code with the serial port shield and the tinyZero: It works but I have to switch the USB cable between the CPU board USB and the serial shield USB. That is a pain :(


temecom

  • Newbie
  • *
    • Posts: 3
    • View Profile
Solved... use the SerialMonitorMacro:
#if defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#else
#define SerialMonitorInterface Serial
#endif

/**
 * Set up the IO and serial port
 */
void setup() {
  SerialMonitorInterface.begin(BAUD_RATE_115200);
 ...


lennevia

  • Administrator
  • Sr. Member
  • *****
    • Posts: 94
    • View Profile

 

SMF spam blocked by CleanTalk