TinyCircuits Forum
TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: temecom on January 27, 2020, 11:38:38 PM
-
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);
}
-
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 :(
-
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);
...
-
Glad you were able to figure it out so fast!