Hello
This is my first time using Arduino and also Digispark. I bought these to make Dinoflagellates for a science class. This is the tutorial I am following: Dino Tutorial
I followed the instructions from: Digispark Tutorial
That's when I got error 79 and found a github thread that pointed me to the new drivers and external board link. I followed those instructions and burned the bootloader onto the digispark, which went fine.
I can run an example piece of code like Blink and it will upload fine, but when I try and upload this code I get the following:
Sketch uses 886 bytes (13%) of program storage space. Maximum is 6586 bytes.
Global variables use 13 bytes (2%) of dynamic memory, leaving 499 bytes for local variables. Maximum is 512 bytes.
"C:\Users\Ed\AppData\Local\Arduino15\packages\digistump\tools\micronucleus\2.6/micronucleus" --no-ansi --run --timeout 60 C:\Users\Ed\AppData\Local\Temp\arduino-sketch-ADCEB4DE1092110F1A833DBF098009D0/Dino Sketch.ino.hex
> Please plug in the device (will time out in 60 seconds) ...
> Device is found!
connecting: 16% complete
connecting: 22% complete
connecting: 28% complete
connecting: 33% complete
> Device has firmware version 2.6
> Device signature: 0x1e930b
> Bootloader entry condition: The bootloader is activated if the D- pin is high, i.e. a pullup resistor is attached and powered and a power on condition was detected.
> Bootloader exit condition: The bootloader exits fast (< 1 second) if no USB detected.
> Available space for user applications: 6586 bytes
> Suggested sleep time between sending pages: 7ms
> Whole page count: 103 page size: 64
> Erase function sleep duration: 721ms
> Error opening Sketch.ino.hex: No such file or directory
> Error loading or parsing hex file.
Failed uploading: uploading error: exit status 1
Code:
/*
Dinaflagellate Shake and Glow Code
Attach a simple tilt sensor (or two wires that bump into each other)
from andy Q and kitty Q
Public domain
*/
// You will need to change this for other arduino versions - the PWM pin the LED is attached to
int led = 1; // On the Digispark, we set the LED to be Pin 1
int brightness = 255; // how bright the LED is. We start at max 255
int fadeAmount = 20; // how fast to fade our LED fade the LED by
int extragnd = 2; //We are setting pin 2 to basically function as a ground pin to make it easy to plug in our LED
//We connect one wire of our sensor switch here
//The other side of the tilt switch sensor will be connected to GND, so when the switch toggles on, it will read as 0, and when the switch is open it will read as 1.
const int sensorPin = 4;
int sensorval = 0; // Our sensor will either be 0 (Ground - low voltage) or 1 (High voltage (~5V))
int prevstate = 0; // we don't really care about if our sensor reads as a 0 or a 1,
int buttonState = 0; // current state of the button
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
pinMode(sensorPin, INPUT_PULLUP);
digitalWrite(sensorPin, HIGH); //we start our sensor as normally HIGH or 1 when it is not touching ground
pinMode(extragnd, OUTPUT);
digitalWrite(extragnd, 0);
}
// the loop routine runs over and over again forever:
void loop() {
// read the state of the pushbutton value:
//If the switch is tilted one way buttonstate will be 0, and the other way it will be 1
buttonState = digitalRead(sensorPin);
//We don't actually care what buttonstate is, as long as it is different from before
if (prevstate != buttonState) {
brightness = 255;
} else {
}
//save the old button state as the previous state
prevstate = buttonState;
// set the brightness of the LED:
analogWrite(led, brightness);
//if no change happens, it keeps going down until 0
brightness = constrain(brightness - fadeAmount, 0, 255);
delay(30);
}
Any help would be greatly appreciated!