I downloaded the file “hello.ftdi.44.echo.interrupt” *.c and *.make from this link http://academy.cba.mit.edu/classes/embedded_programming/index.html.
I opened the Makefile and I modified the name of “PROJECT” in “blinkLED”. Besides I changed the “F_CPU” in 8000000 (8 Mhz, the standard speed of ATTiny44) because on my board there isn’t the external crystal. Also I added a new declaration “program: program-usbtiny”, in this way when I’ll appeal the Makefile from Linux Terminal, I should not specify all times that the programmer is –usbtiny. Anyway, if I will program with another programmer, I should specify it in the Makefile replacing the voice –usbtiny with the new programmer.

Subsequently I opened the C file. First of all, I activated the PORTA like output, through the DDR (Data Direction Registers). So I wrote:

DDRA |= (1 << PA7);
With this expression, I declared that the pin/bit n°7 of the ATTiny44 must be 1, that is TRUE.
I might have to write “0b10000000”.

In the program, I wrote that at first, the LED should light and await for 100 ms:

PORTA |= (1 << PA7);
delay_ms (100);
At last, I wrote that the Led will switch off and stay off for 50 ms:

PORTA &= ~(1 << PA7);
_delay_ms (50);
...and that’s it, you can see the program and blink LED here.

/* Blinker Demo */

// ------- Preamble -------- //
#include                         /* Defines pins, ports, etc */
#include                     /* Functions to waste time */


int main(void) {

  // -------- Inits --------- //
  DDRA|=(1 << PA7);            /* Data Direction Register A:
                                   writing a one to the bit
                                   enables output. */

  // ------ Event loop ------ //
  while (1) {

    PORTA |= (1 << PA7);          /* Turn on 7th LED bit/pin in PORTA */
    _delay_ms(100);                                           /* wait */

    PORTA &= ~(1 << PA7);          /* Turn off all A pins, including LED */
    _delay_ms(50);                                            /* wait */

  }                                                  /* End event loop */
  return (0);                            /* This line is never reached */
}

blinkLED.c
blinkLED.make






I copied the Makefile in other directory, changing name in “buttonLED.make”. I opened it and changed “PROJECT”. After this, I made a new C file, nominated “buttonLED”. I declared the pin of button, PA3:

DDRA &= (1 << PA3);
PORTA |= (1 << PA3);

After this I declared where I wired the led on my board, in PA7. So I started to write the wile with if function. If the button is not pressed, my led turn off:
if (PINA & (1 << PA3)) {
PORTA &= ~(1 << PA7);

Otherwise, after 10 ms of delay, when the button is pressed, led switch on:
} else {
_delay_ms(10);
if ((PINA & (1 << PA3)) == 0) {
PORTA |= (1 << PA7);

Bellow you can read all program and relative files.
#include 
#include   
int main(void) {

  //Button = Attiny44 pin PB2
  DDRA &= (1 << PA3);
  PORTA |= (1 << PA3);

  //LED = Attiny44 pin PA7
  DDRA |= (1 << PA7);
  PORTA |= (1 << PA7);

  while (1) {

	if (PINA & (1 << PA3)) {            //check if button is NOT pressed? (1)
	    PORTA &= ~(1 << PA7);           //turn LED off
  	 
	} else {
	  _delay_ms(10);                    //Delay in ms (Debouncing)
	if ((PINA & (1 << PA3)) == 0) {     //check if button is pressed? (0)
    	PORTA |= (1 << PA7);                //turn LED on	
   }
  }
 }
}

buttonLED.c
buttonLED.make






After installed the ATTiny Library on Arduino IDE, following this guide:
http://highlowtech.org/?p=1695.
I opened the “Blink” sketch of Arduino IDE. In the first time, I set from tool option, the board ATTiny, Processor ATTiny 44 and Clock 8 MHz.



I set the number of my pin led, I check correct nomenclature of ATTiny port in Arduino IDE:
(ATTiny port) PA7 = Pin 7 (Arduino Pin) In this picture, you can see better the port:



Then I change, by choice, the first and second delay in 100 and 50 ms. Bellow you can read all program and relative file.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 7. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */


// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 7 as an output.
  pinMode(7, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(7, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);              // wait for a second
  digitalWrite(7, LOW);    // turn the LED off by making the voltage LOW
  delay(50);              // wait for a second
}

BlinkLED.ino






After opened the “Button” sketch of Arduino IDE, I set the number of push button and led pin. I check correct nomenclature of ATTiny port in Arduino IDE:

(ATTiny port) PA3 = Pin 3 (Arduino Pin)
(ATTiny port) PA7 = Pin 7 (Arduino Pin)

In this picture, you can see better the port:



Then I use “DigitalWrite” command for to switch on the pull-up resistor of pin button:

digitalWrite(buttonPin, HIGH);

Instead, in the “void loop”, I changed the “button State” in LOW:
if (buttonState == LOW) {
Because in my case when I press the button, the signal is 0, not 1. Because the pull-up resistor transmits the signal in VCC. Therefore, when the button is not pressed, the signal go to VCC, so the “buttonState” is HIGH.



Bellow you can read all program and relative file.
/*
  Button

 Turns on and off a light emitting diode(LED) connected to digital
 pin 13, when pressing a pushbutton attached to pin 2.


 The circuit:
 * LED attached from pin 13 to ground
 * pushbutton attached to pin 2 from +5V
 * 10K resistor attached to pin 2 from ground

 * Note: on most Arduinos there is already an LED on the board
 attached to pin 13.


 created 2005
 by DojoDave 
 modified 30 Aug 2011
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/Button
 */

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 3;     // the number of the pushbutton pin
const int ledPin =  7;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
  //Turn internal resistor ATTiny pull-up ON (1)
  digitalWrite(buttonPin, HIGH);        
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is LOW (0):
  if (buttonState == LOW) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

ButtonLED.ino



For Firefly program experiment, I used my Satshakit board. Because with my Hello Board I think that it’s not possible, rather it’s not simple to do because should I change the Firmata loading on board. The Firmata is a program that you upload on board (Arduino or Satshakit) with Arduino IDE. It has the instructions of Firefly components. After this, you can go on Firefly and use it for program your board. For to use this add-on, you must use the basic components that which replace “digitalRead”, “digitalWrite”, etc… Therefore, I prepared Grasshopper canvas with these components:





I took the Blink component and wrote the timing, for example, 100 ms. In most component in Firefly there is a “Start/Stop Boolean toggle”, for switch on/off the component. Then I wired the output component with Pin13 in “Uno Write” component.



So, in real time the Satshakit’s Led switch on and of the led. If I change the timing of Blink, the blinking led change immediately. Now you can modify the program and to see immediately the change. This is very usefully for to prototyping, though it doesn’t have all function. Anyway, if you want you can use the board without the PC wiring. You can do it, uploading the Arduino Code generated from the “Code Generator” component.



In addition, I played to interact with Rhino interface. I drew one circle, with Grasshopper component. I used the slide component for to allow change the radius. Then I create de surface from this circle and changed the colour in green. For to blink this circle I used the “Cull Index” component, that is erase or not the element by Boolean toggle. I wired this with Blink component, so when the Led switch on, the circle surface is on, instead when the Led switch off, the relative circle surface switch off in real time.



Bellow you can see all algorithm and you can download it from relative file.



Satshakit Blink LED with Firefly software from Mario Fullone on Vimeo.


Satshakit BlinkLED.gh



For the Button Led exercise, I wanted to use the simple “button” component of Firefly. So I created one virtual button for to use. I took the component and wired with Pin 13, and that’s it! Bellow you can see all algorithm and you can download it from relative file.



Satshakit Button LED with Firefly software from Mario Fullone on Vimeo.


Satshakit ButtonLED.gh

Sketch Design Logo