Computer on a punch card

My latest Arduino excursion is the Paperduino Tiny. It is an eight pin package, the ATtiny85-20PU. It is an interesting circuit, laid out on a paper card and connected on the back with long leads and a few extra wires. It appears to be based on a small version of the Arduino family called Digispark.

You will be pointed to the digispark site for the IDE.

The instructions are set out for you to acquire all the components and assemble it, including burning the bootloader into the chip. I opted for the kit version offered on the site, but it appears the kit is no longer available.

If you decide to give it a try, go slow and use care.

My paperduino sketch, a mix of the fade and melody sketches, is posted on github.

My Paperduino project.

My Paperduino project.

 

 

 

 

 

 

 

 

The sketch

/*
 Fading
 
 This example shows how to fade an LED using the analogWrite() function.
 
 The circuit:
 * LED attached from digital pin 9 to ground.
 
 Created 1 Nov 2008
 By David A. Mellis
 modified 30 Aug 2011
 By Tom Igoe
 
 http://arduino.cc/en/Tutorial/Fading
 adapted to paperduino
 This example code is in the public domain.
 
 */
#define NOTE_C4  262
#define NOTE_G3  196
#define NOTE_A3  220
#define NOTE_B3  247

// notes in the melody:
int melody[] = {
  NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 8, 8, 4,4,4,4,4 };
  
int ledPin = 1;    // LED connected to digital pin 1
int ledPin2 = 0;   // LED connected to digital pin 0
void setup()  { 
  // nothing happens in setup 
  
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    // to calculate the note duration, take one second 
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations[thisNote];
    tone(4, melody[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(4);
  }
} 

void loop()  { 
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
    analogWrite(ledPin2, fadeValue - 30); 
    
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 

  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
    analogWrite(ledPin2, fadeValue - 30);    
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 
}


 

About jcoffey

https://profiles.google.com/jerry.coffey/posts
This entry was posted in Arduino and tagged , . Bookmark the permalink.