Pinout documentation

jfputnam · 21 · 35054

TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 108
    • View Profile
    • TinyCircuits Homepage
On the TinyLily Mini, the numbers shown correspond to the Arduino "pin numbers", such as for the digitalWrite function.  So 0 as marked on the TinyLily Mini is accessed as pin number 0 in the Arduino IDE.  The ones that have the A prefix are analog pins.  In total, digital pins 0, 1, 2, 3 are supported, and analog (or digital) pins A0, A1, A4 and A5 are supported.  There are also some alternate functions on the pins (the same as an Arduino Uno), so A4 and A5 can also be used as I2C pins, and pins 0 and 1 are connected up to the USB programmer.

Because 0 and 1 are connected to the USB programmer, you can't use this pins at the same time as when the USB is plugged in (which is why it might look like they are not working to some people). 

The + and - pins are power and ground.  There are two sets of these, and they are connected together.  The reason for this is that you can have a battery hooked up to one pair, then the other pair can be used to provide power out to any peripherals you have. 

The 6 pins in the middle (that aren't soldered to anything) are for an in-circuit programming connection.  This lets you program the microcontroller initially with the Arduino IDE, and a 6-pin connector can be soldered in to allow ICSP programming and debugging using an external debugger, but most Arduino users will never use this.  If you look at the schematic, the ICSP connector used the SPI pins on the processor, so if you absolutely need some additional I/O points, you can grab a few more signals off of this.

Thanks,

Ken
TinyCircuits


rosewater

  • Newbie
  • *
    • Posts: 2
    • View Profile
In reply to wikkit, "pin 0 does not do anything". AFter lot of frustration and trial and error, I found out that pin 0 does actually work, but only if the tiny lily is powered externally from a battery, and not connected to to the USB of my computer.

Even trying Serial.end() does not disable serial mode if connected to the USB cable to computer.



CaptClaude

  • Newbie
  • *
    • Posts: 4
    • View Profile
After some tinkering, I managed to get some LEDs to blink.  When connected to the USB thingie, pins 0 & 1 are not useful but when connected to 3xAA batteries, they work OK, but 0 always glows before the sketch gets moving after applying power.  If blinking LEDs is the goal (and for me, believe it or not, it is), best not use 0 at all.

Can the analog pins be PINMODE-ed to digital?  If so, what are their pin numbers?  I know for instance that there is no pin 4 because
Code: [Select]
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
and then
Code: [Select]
digitalWrite(4, HIGH);   // set the LED on
delay(3000);              // wait for 3 seconds
digitalWrite(4, LOW);    // set the LED off
Does nothing.

The end goal is to use the tinylily to drive (though a couple of transistors) some HB LEDs to illuminate some (found on Amazon) fiber-optic flowers to be used as stage props in a production of Shakespeare in Hollywood.  I am trying to get a "breathe"-style but the first adapted sketch I tried didn't work and my attempts at dimming with
Code: [Select]
void loop()
{
  for(i = 0 ; i <= 255; i+=1)
  {
    analogWrite(LEDpin, i);
    delay(20);
  }
  for(i = 255 ; i >= 0; i-=1)
  {
    analogWrite(LEDpin, i);
    delay(20);
  }

}
tonight have not gone anywhere -- the LED comes ON and then goes OFF.  It's been a while since my last Arduino project (likewise for the theatre) so my brain may be rusted shut.

Are there restrictions on which pins can PWM and which not?

Thanks!


CaptClaude

  • Newbie
  • *
    • Posts: 4
    • View Profile
I have at least in part answered my own question:  Pin 3 is a PWM pin -- we know this because the motor sketch example uses it.  :-[
I would still like to know if there are any other pins that can PWM.

The really interesting thing is that my test sketch does not run when connected to USB, only when run off external power (3xAA works great).

Cheers.


CaptClaude

  • Newbie
  • *
    • Posts: 4
    • View Profile
Something else I am sure that everyone else knows but which I feel compelled to document here:  The a0, a1, a4 & a5 pins are also digital output pins.
THe next experiment will try and see if any of them are also PWM pins.
Code: [Select]
/*
  Blink a0, a1, a3, a4 pins
 */
 int pin;

void setup() {               
  // initialize the pins as an output.
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, OUTPUT);
 
}

void loop() {
  pin = 14;
  digitalWrite(pin, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(pin, LOW);    // set the LED off
  pin = 15;
  digitalWrite(pin, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(pin, LOW);    // set the LED off
  pin = 18;
  digitalWrite(pin, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(pin, LOW);    // set the LED off
  pin = 19;
  digitalWrite(pin, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(pin, LOW);    // set the LED off

}

Let's not all chime in here at once...

Cheers.


 

SMF spam blocked by CleanTalk