Hello,
I have always done my projects using Arduino IDE.
This works fine for prototypes, but for production PCBs, I'd like to be able to work with other MCUs.
I am working in Atmel Studio 7 with an Atmel ICE and an ATmega328p.
First, I'd like to establish a simple test like blinking an LED.
I took the basic blink sketch from arduino and imported it into Atmel Studio 7.
/*Begining of Auto generated code by Atmel studio */ #include <Arduino.h> /*End of auto generated code by Atmel studio */ //Beginning of Auto generated function prototypes by Atmel Studio //End of Auto generated function prototypes by Atmel Studio /* Blink Turns an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi modified 8 Sep 2016 by Colby Newman This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Blink */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(3, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(3, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(3, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
I can get the LED to flash, but its for like 10 seconds on and off.
I checked in the programming tool and the fuses are set to use the 8 mhz internal timer.
What am I doing wrong so far?
The other concern I have is that my planned design uses both a 328p and a tiny85.
328p is i2c master and sends instructions to tiny85.
No Arduinos use a tiny85 to my knowledge, so I'm wonder how writing code for tiny85 in Arduino IDE would work, or if it is even possible.
I'm not opposed to learning C, and writing sketches from scratch in Atmel Studio for these devices.
From what I understand, code written in C should work on any of the Atmel chips supported by my Atmel ICE.
Is learning C my best option to this problem, or should I continue to work with Arduino IDE and Atmel Studio both and let Arduino IDE do the heavy lifting when it comes to programming?
If learning C is my best option, can you point me to resources to help shorten the learning curve?
Thanks,
Caddy