So now I have timer code set up and ready to go. But now I cant figure out how to program this little guy. So here is where Im at.
Plugged the Trinket in to the pc, driver has loaded fine.
Ive gone in and selected USBtinyISP from the programmer in the tools menu.
Under Boards in the tools Menu, I have " Arduino Gemma" selected
In the Tools Menu "port" is grayed out. Question: Is there supposed to be a port available using this configuration?
Before I upload I press the button on the board and it goes dim initially and then pulses afterward.
So with no port selected as there is not an option available; Ive tried to upload and I get an error.
"avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)"
I am running an older version of the Arduino IDE I think; its version 1.6.7
My PC is running window 8.1 and does not have USB 3.0 ports they are 2.0 versions.
My code:
Code: Select all
int InputPin = analogRead(0); // select the input pin for the potentiometer
int OutputPin = 3; // select the pin for the LED
int sensorValue=0; // variable to store the value coming from the sensor
int InputState = 0;
void setup()
{
// declare the ledPin as an OUTPUT:
pinMode(OutputPin, OUTPUT);
pinMode(InputPin, INPUT);
}
void timer1(){
InputState = digitalRead(InputPin);
int timer1_value = (50);
for (int i = timer1_value; i >= 0; i--){ //Begin the loop
delay(100);
}
}
void timer2(){
int timer2_value = (1);
for (int i = timer2_value; i >= 0; i--){ //Begin the loop
delay(100);
}
}
void loop() {
if (InputState == HIGH){
digitalWrite(OutputPin, LOW);
timer1();
digitalWrite(OutputPin, HIGH);
timer2();
}
else{
digitalWrite(OutputPin, HIGH);
}
}