How can i run C code in Arduino ?

mcgyvr

Joined Oct 15, 2009
5,394
Can you be a bit more specific?
Are you just saying you want to write code in C and not use the Arduino IDE?

Or are you wanting to write programs and not have to use the setup and void loops?
 

alfacliff

Joined Dec 13, 2013
2,458
the arduino does not have the memory to hold a run time c program. the probrams are compiled so they actually run in machine language of 1's and 0's which takes much less memory.c is like basic and other languages, made readable to humans, but very seldom to processors.
 

shteii01

Joined Feb 19, 2010
4,647
You can not because Arduino can not.

Arduino language is C like, but IT IS NOT C.
Either rewrite your C code or find someone to rewrite it for you.
 

shteii01

Joined Feb 19, 2010
4,647
People, people, people...

The problem is not the microcontroller. Yes, it is ATMega 328 with a bootloader.

The problem is the ability to load code into the ATMega 328. That is why the dude is using Arduino board and Arduino environment. But since both parts are Arduino, it needs to be in Arduino language. Which the dude is not willing (yet) to invest any time into. So the dude has two choices:
1) rewrite the code
2) buy/build/steal hardware to load code into ATMega 328, buy/steal ATMega 328 chip or chips. But that just the microcontroller chip, you still need the rest of the circuit that goes around the microcontroller, like: clock crystal, capacitors, resistors, RS232 chip, etc., it is eFFING easier to just buy Arduino board and rewrite the C code.
 

shteii01

Joined Feb 19, 2010
4,647
From the website: https://www.arduino.cc/en/Guide/Introduction

"To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing."
Wiring: http://wiring.org.co/
Processing: https://processing.org/

"and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if you want to."


Well. I did find how to load C into Arduino Uno: https://balau82.wordpress.com/2011/03/29/programming-arduino-uno-in-pure-c/ So I guess OP's problem is solved.
 

DickCappels

Joined Aug 21, 2008
6,099
Yes, to program an AVR controller without the bootloader you need an inexpensive programmer. Software for the programmers are free and widely available.
 

dannyf

Joined Sep 13, 2015
2,197
The simplest would be to write your C code in the arduino ide and compile it and upload it to your arduino.

Nothing else is needed.
 
Top