Hi,
I am new to microcontrollers and created a first project with Arduino Nano.
Now I want to run this on a Digispark and I don't know how to connect the following components to the pins:
2 LED for digitalWrite - prefered to P0 and P1
3 Poti for analogRead values only for delays - prefered to P2, P3, P4
1 Pushbutton for interrupt to awake board from sleep - prefered to P5
Can I connect this functions to these pins?
If so, how do I set the interrupt for connecting the pushbutton to P5.
For Arduino I set the interrupt with "attachInterrupt(0, Ringing, LOW);" and have to connect the pushbutton to D2.
Do I have to use "FALLING" instead of "LOW" in the interrupt call (I did not found a Digispark example with "LOW")
That's the Arduino Code:
#include <avr/sleep.h>
#include <avr/power.h>
const int Bell = 2;
const int LiftHandset = 3;
const int Redial = 4;
int Startup = 1;
void Ringing(void)
{
detachInterrupt(0);
}
void GoSleep(void)
{
attachInterrupt(0, Ringing, LOW);
delay(100);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
}
void setup()
{
pinMode(Bell, INPUT);
pinMode(LiftHandset, OUTPUT);
pinMode(Redial, OUTPUT);
}
void loop()
{
if (Startup == 0)
{
digitalWrite(LiftHandset, HIGH);
delay(analogRead(A0)/1.023*0.5);
digitalWrite(Redial, HIGH);
delay(analogRead(A1)/1.023*1.5);
digitalWrite(Redial, LOW);
delay(analogRead(A2)/1.023*15);
digitalWrite(LiftHandset, LOW);
}
else
{
Startup = 0;
}
GoSleep();
}
Thanks for any answer and please excuse my lousy english
kloeppi