After lurking on this forum for years now (I'm currently on my senior year) I decided to create an account since I need help / 2nd opinions or suggestions for my big final project. I'm making a basic project with an ATMega328:
I need to use an ATMega (in this case, I chose to go with the 328p version + an external 16Mhz crystal) and create a program (and build it) where I have a 1Hz square wave output (I connected a LED in order to simplify this step - 500ms the led is on / 500ms the led is off) + a basic PWM control (I'm thinking about using a fan / motor in order to change it's speed via PWM - i.e. pressing switch 1 will increment pwm in 10, pressing switch 2 will decrement pwm in 10, pressing switch 3 will force pwm to 50, pressing switch 4 will force pwm to 100, pressing switch 5 will force pwm to 0).
At the moment I (think) I've made the first step and completed the led / square wave output code (image below). I also built my circuit on a breadboard (image below) aswel as in a schematic (didn't simulate, didn't had the time yet; image below). If this is alright, I'm missing the PWM part and that's it.
My issue here is:
Since I can only test it next week, is the code fine (schematics aswell)? I can't seem to understand how the debug function on Atmel Studio works (my last time messing around with microcontrollrers was 1 year ago. Since then I had 1 or 2 projects in arduino so I kinda forgot some basic ATMega things).
Also, it would be helpful to replace the voltage source (10V in the beggining of the circuit) with some sort of battery, etc. so I could experiment the circuit at home. Any idea if that's something hard to find / implement?