IV. Programming in ‘C’ by using Atom¶
Alternatively to the Arduino IDE it is also possible to use the Atom Editor with the PlatformIO plugin.
installing Atom with PlatformIO¶
Just download and install Atom. After first start, PlatformIO can be installed with the inbuild plugin manager.
create a new project¶
After a long installation process, atom restarts and shows a new ‘welcome page’.
There we can click on New Project
Then just give the project a name and choose the Board, you want to flash.
wrtiting code¶
In the navigation bar on the left side, is the folder structure of the created project. The code has to be write in the main.cpp
which is inside the src folder
Inside the main.cpp
is the same example code, as in the ArduinoIDE.
I would like to program the Hello-World board in ‘C’, so I delete everything inside the main.cpp
to start from scratch.
For testing, I use the following blink sketch, which is written in C
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// Set Data Direction to output on port B, pins 2 and 3:
DDRB = 0b00001000;
while (1) {
// set PB3 high
PORTB = 0b00001000;
_delay_ms(250);
// set PB3 low
PORTB = 0b00000000;
_delay_ms(250);
}
return 1;
}
uploading the sketch¶
After connecting the FabTinyISP with the Hello-World board, just click the upload button and the flashing process starts.
After the success message, the Board starts to blink.
personal reflection¶
I personally really don’t like that kind of ‘overblown’ IDEs. Maybe for more professional developer it could be helpful. I additionally had problems with Atom + PlatformIO in the past.
Then, the installation broke some system-variables on my Windows machine. I hadn’t that problems this time, but the bad taste stays.
A view years ago, I also did a view tests with codebender, but it needs to be online, so this was no alternative for me, too.
I’ve found a very good way to organize my projects with the ArduinoIDE and for sure I will stay on it for a long time.