Hello, I was trying to create a start/stop watch sketch in which when you press a button it will start, stop, then start the timer again when the button is pressed and it will display it on an OLED. I actually got this code using chatgpt. When I verify the code it says 'Tiny4kOLED' has not been declared. It will say that on any part that has Tiny4kOLED starting from the bottom of the code. If I comment the very bottom line that has Tiny4kOLED, it will just say the same message on the line above it. How can I fix this? Here is the code
I just changed the code to this. The oled display on an attiny must have this. I know because of several projects that I have with an OLED on an attiny. It did verify correctly but when I turn on the power, nothing will display. I know that the code should have a line in which it will clear out text. I'm guessing that's the case? Here is the code.
Apart from the built-in pull-up resistors, the D+/D- lines of the Digispark Board have additional R-D network that has convinced me to install external pull-down in order to make the push button working.
I would suggest you start with some of the tutorials that are on line, sorry to say some are not so good but many are very good. Start by learning
the basics, you will need to control outputs as well as interpret inputs such as reading a switch, receiving a message etc. Start with the LED, they are not expensive and there is even one on most of the Arduinos. At this point you should have also found several tutorials on basic electronics that you
have gone through.
You should acquire a copy of the Arduino Cookbook and go through that. I have no clue as to how fast you will learn this but it will not be a one night study. During this process you will learn what an IDE is and how to use it to generate and upload your code to the Arduino. Let us know how you progress. For more help check this link: https://docs.arduino.cc/learn/starting-guide/getting-started-arduino/
Have you run the sketch? It is a working sketch under Digispark ATtiny85 Dev Board. If the sketch runs and there is output on the OLED, then it means that C++ affairs have been taken care of by the Library
Note:
In C++, an object is created from Class Name (aka user defined data type).
Method is applied on an object.
object.method = function