Go Down

Topic: What is the status of serial on a tiny85 (Read 10 times) previous topic - next topic

Erni

Success.
I tried with attiny85 at 8Mhz and it worked just fine.
I only tried with 4800, but will  test with higher baudrate.

my test sketch:

Code: [Select]


#include <SoftwareSerial.h>
const int rx=2;
const int tx=3;


SoftwareSerial mySerial(rx, tx);

int i=0;
char buf[10];

void setup()
{
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
   mySerial.begin(4800);
 
}

void loop()
{
  if (mySerial.available()>0){
   
    buf[i]= mySerial.read();
   
    if (int(buf[i])==13 || int(buf[i])==10 ){  //If Carriage return has been reached
 
        mySerial.println(buf);
       
      for(int x=0;x<=8;x++){
      buf[x]=' ';
      }
     i=0;  //start over again
   
    } //if enter
    i++;
    } //IF mySerial.available
   
}//LOOP

JohnO

Hi, I am keen to see this fix in the tiny84 currently I get the compile error:
~~~~
C:\Users\John\Documents\arduino\libraries\jeelib/Ports.h:325: error: conflicting return type specified for 'virtual void UartPlug::write(byte)'
C:\Dropbox\SKETCHES\hardware\tiny\cores\tiny/Print.h:73: error:   overriding 'virtual size_t Print::write(uint8_t)'
~~~~

Erni


In the first sketch I used the serial monitor as input.

Now I tried this sketch on my Uno, connected UNO tx->tiny rx
It works as it should, no garbled characters and at 9600 baud.

I use a CP2103 serial/USB converter from Ebay to test the output from the Tiny

Code: [Select]

int x=0;
char buffer[10];

void setup()
{
   Serial.begin(9600);

}

void loop()
{
  sprintf(buffer, "Test:%03d",x);
Serial.println(buffer);
  x++;
  delay(500);
}//LOOP

Coding Badly

Hi, I am keen to see this fix in the tiny84 currently I get the compile error:


With the version in Reply #14?

Coding Badly


Go Up