-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from roleroz/master
Allow Arduino as ISP as programmer
- Loading branch information
Showing
7 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load("//platformio:platformio.bzl", "platformio_project") | ||
|
||
configs = [ | ||
{ | ||
"name": "attiny85", | ||
"board": "attiny85", | ||
"build_flags": ["-DTARGET_PIN=4"], | ||
"programmer": "arduino_as_isp", | ||
"port": "/dev/ttyUSB0", | ||
}, | ||
{ | ||
"name": "nano", | ||
"board": "nanoatmega328", | ||
"build_flags": [], | ||
"programmer": "direct", | ||
"port": "unused", | ||
}, | ||
] | ||
|
||
[platformio_project( | ||
name = "blink_%s" % config["name"], | ||
src = "blink.cc", | ||
board = config["board"], | ||
framework = "arduino", | ||
platform = "atmelavr", | ||
build_flags = config["build_flags"], | ||
programmer = config["programmer"], | ||
port = config["port"], | ||
deps = [ | ||
"//tests/arduino:Arduino_impl", | ||
"//tests/arduino:Arduino_interface", | ||
], | ||
) for config in configs] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# A blinking LED | ||
|
||
The most classic electronics example, blinking an LED, is an example of an | ||
Arduino project. | ||
|
||
This project has no inputs, and only uses one output to blink the LED. | ||
|
||
## The circuit | ||
|
||
### On Arduino Nano | ||
You don't need to connect anything, the Arduino Nano has an internal LED | ||
connected to the right pin | ||
|
||
### On Arduino Mega | ||
![The clinking LED breadboard](doc/blink_attiny_bb.png) | ||
|
||
The [Fritzing](http://fritzing.org) circuit is stored in file | ||
[binary_counter.fzz](doc/blink_attiny.fzz). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Blink an LED. The "hello world" of electronics. | ||
// | ||
// By default this will blink an LED connected to pin 13 (standard Arduino) | ||
// with a 1/2 Hz frequency and a 50% duty cycle (1 second on, 1 second off). | ||
// | ||
// You can change the behaviour with the following macros at compile time: | ||
// - TARGET_PIN: The number of the pin where the LED is connected to | ||
// - TIME_HIGH_MS: The number of milliseconds the LED will be on per cycle | ||
// - TIME_LOW_MS: The number of milliseconds the LED will be off per cycle | ||
|
||
#include <Arduino.h> | ||
#include <Arduino_impl.h> | ||
#include <Arduino_interface.h> | ||
|
||
using arduino::ArduinoImpl; | ||
using arduino::ArduinoInterface; | ||
|
||
#ifndef TARGET_PIN | ||
// If target pin is not defined, use the Arduino standard 13 | ||
#define TARGET_PIN 13 | ||
#endif | ||
#ifndef TIME_HIGH_MS | ||
#define TIME_HIGH_MS 1000 | ||
#endif | ||
#ifndef TIME_LOW_MS | ||
#define TIME_LOW_MS 1000 | ||
#endif | ||
|
||
// Arduino hardware layer. | ||
const ArduinoImpl ino = ArduinoImpl(); | ||
|
||
void setup() { | ||
pinMode(TARGET_PIN, OUTPUT); | ||
} | ||
|
||
void loop () { | ||
ino.DigitalWrite(TARGET_PIN, HIGH); | ||
ino.Delay(TIME_HIGH_MS); | ||
ino.DigitalWrite(TARGET_PIN, LOW); | ||
ino.Delay(TIME_LOW_MS); | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.