I am currently trying to send data from Pi3 (Model B) to my TinyCircuit's TinyDuino. For now, I have set on my TinyDuino to search for a '\n'. Once that is detected, it will increment a counter which was set in the ino file. For now, I am not sure why the code isn't detecting the '\n' char.

Here is my Python Code to send data from Pi3 to TinyDuino:
import serial with serial.Serial('/dev/ttyUSB0', 9600, bytesize=serial.EIGHTBITS, timeout=0.5) as ser: ser.flushInput() string1 = "\n" print string1 ser.write("\n")

Here is the code on the TinyDuino side:

#define  BLACK           0x00
#define BLUE            0xE0
#define RED             0x03
#define GREEN           0x1C
#define DGREEN           0x0C
#define YELLOW          0x1F
#define WHITE           0xFF
#define ALPHA           0xFE
#define BROWN           0x32

#include <TinyScreen.h>
#include <SPI.h>
#include <Wire.h>

TinyScreen display = TinyScreen(0);

int inputString = 0;         // a String to hold incoming data
bool stringComplete = false;  // whether the string is complete

void setup(void) {

int switcher = 1;
int mostSignificantDigit = 0;

void loop() {
 for(int i=0;i<5; i++)
   display.print("                    ");
 display.print("Number of People:");
 display.fontColor(BLUE,BLACK);// testing. can be removed
 //display.print(inputString); // testing. can be removed
 if (switcher == 1)
   if (stringComplete) 
     //mostSignificantDigit = 0;
     //mostSignificantDigit = inputString;
     // clear the string:
     //inputString = 0;
      stringComplete = false;


 void serialEvent() {
    while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    // if the incoming character is a newline, set a flag so the main loop can
// do something about it:
if (inChar == '\n') {
  stringComplete = true;
  mostSignificantDigit = mostSignificantDigit + 1;


Based on the TinyCircuit's Website, the TinyDuino uses a Atmega328P processor (same as is used on the Arduino Uno) (it uses 3.3V, 8MHz). Both devices have been set to the same baud rate, which is 9600. Would really appreciate if there's any way to detect the char!!

  • 1
    Hi, I realised that the Arduino reset itself (based on this post - stackoverflow.com/questions/37218181/… ). – festivezine Nov 23 at 11:02
  • good catch ..... one thing to mention .... when debugging a communication problem such as yours, change the character that you are searching for .... use something like x or 5 instead of \n because they are clearly visible on the serial monitor ... also if your code appends an unintended \n, then you will see that also – jsotola Nov 23 at 21:42
  • you can post your comment as an answer and accept it ...... add in some information, to the answer, about what you actually did to solve the issue – jsotola Nov 23 at 21:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.