Skip to content

Instantly share code, notes, and snippets.

@twolfson
Created October 14, 2020 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twolfson/9a6c079aa6c9abff371b6ea8fd374d32 to your computer and use it in GitHub Desktop.
Save twolfson/9a6c079aa6c9abff371b6ea8fd374d32 to your computer and use it in GitHub Desktop.
Explore SoftwareSerial and using Arduino Uno as a proxy for ATtiny85
.pio/
include/
lib/
src/
test/
// https://www.arduino.cc/en/Tutorial/LibraryExamples/SoftwareSerialExample
/*
Software serial multple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 2 (connect to TX of other device)
* TX is digital pin 3 (connect to RX of other device)
Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <Arduino.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(PB1, PB2); // RX, TX
void setup()
{
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() // run over and over
{
mySerial.print("Hello world!");
// digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
// mySerial.print("Hello world!");
// digitalWrite(LED_BUILTIN, LOW);
// delay(1000);
}
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = attiny85
[env:attiny85]
platform = atmelavr
board = attiny85
framework = arduino
; Default fuses
; avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
; https://docs.platformio.org/en/latest/platforms/atmelavr.html#fuses-programming
; To update, run: platformio run -t fuses
; Default
; board_fuses.efuse = 0b11111111
; board_fuses.hfuse = 0b11011111
; board_fuses.lfuse = 0b01100010
board_fuses.efuse = 0b11111111
board_fuses.hfuse = 0b11011111
board_fuses.lfuse = 0b11100010 ; CKDIV8 disabled (now delay is same as an out of the box Arduino)
; Set same timing across boards (not quite perfectly in sync, likely RC issues but close enough)
board_build.f_cpu = 8000000L ; 8MHz
[env:arduino_uno]
platform = atmelavr
board = uno
framework = arduino
; Set same timing across boards (not quite perfectly in sync, likely RC issues but close enough)
board_build.f_cpu = 8000000L ; 8MHz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment