Digispark

Can I use "double" in my code for a digispark board using an Attiny 85?
Double seems to be 4 X bytes which is 32 bits.
Or is that not permissible?
Below is my code for Attiny85

double pulse;
void setup()
{
pinMode(0,INPUT);
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
}
void loop()
{
digitalWrite(1,HIGH);
delayMicroseconds(5000);
digitalWrite(1,LOW);
delayMicroseconds(200);
pulse = pulseIn(0,HIGH,5000);
if(pulse > 920)
{
tone(2, 1);
delay(500);
noTone(2);
}
}

Hi,

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Using :

unsigned long pulse;

Would make pulse a 4 byte (32bit) integer, you are aware that the maximum value for delayMicroseconds is 16383, aren't you?