C is a procedural programming language which is widely used in embedded systems. PLEASE NOTE: Arduino is typically programmed in C++, not C.
0
votes
0answers
15 views
Is there any way to import libcoap into Arduino project?
I am currently playing with libcoap (https://libcoap.net) client-server architecture. I need directions importing libcoap into Arduino project. Or any other way to implement CoAP (constrained ...
-1
votes
0answers
25 views
Convert Arduino Code to Atmega SFR Code
What steps do I follow to convert the Arduino code to Atmega SFR code? I need to use DDRx, PORTx, PINx
Code sample follows:
#define CLK_FF_PIN 13
#define D_FF_PIN 12
#define ...
0
votes
1answer
16 views
Issue with leOS2 for one-time tasks
I'm trying to use the last version of leOS2 scheduler from Leonardo Miliani ( https://github.com/leomil72/leOS2 ) but I have a strange behavior with a very simplistic ONETIME task.
Platform : Arduino ...
0
votes
2answers
20 views
Problems with linking a library with a c program in linux
I am totally new to C and arduino. I want to run serial commands from a Bealgebone to a 4Dsystems display. Therefore I copied the c library found here into a directory and created a test program ...
0
votes
2answers
75 views
What wrong with that code?
Hi i have made this code
its so simple its should receive data from the computer and send it back via the serial but the problem is he do not what it is suppose to do
when its run its keep sending -1 ...
1
vote
1answer
24 views
Arduino snake on 5110 screen - some help needed
I'm trying to make a snake game using the u8g lib. But for now, only the second body part of the snake follows the head, where I want the whole body to follow the snake's head and I don't understand ...
2
votes
1answer
41 views
How does this code move the bird sprite in this sketch?
I'm teaching this sketch in my class. I understand most of the sketch and can see the class that makes the bird move, but I still don't quite understand how the code makes the sprite "move." I can ...
0
votes
2answers
16 views
Arduino ethernet need help with game logic!
I'm making a game where there are three LED's and three buttons, 1 LED for 1 button. One has to press the button that has it's LED lid, if correct, another (random) LED will light up and the game ...
-1
votes
2answers
51 views
arduino project for c programming language [on hold]
i am a student from 2nd semester BCA (Bachelor in Computer Application). My group need some project for presentation from c programming language so i thought of using #ARDUINO project for our ...
0
votes
1answer
41 views
Interrupt not firing on motion
I'm trying to get MMA8452Q to trigger an interrupt when motion is detected and wonder if I'm missing something very obvious here.
So I setup CTRL_REG4 to 0x0B with
void MMA8452Q::setupISR()
{
...
1
vote
2answers
44 views
Not waking up more than once?
I'm trying the following code on an Uno. I'm pulling the high side of a pull down 10K resistor to 5V, but it can only be woken once. Just once. Does anyone know why this might be the case?
It works ...
0
votes
1answer
45 views
Interrupt variable not getting called while executing another part
volatile byte _incomingFlag = 0;
void onIncoming () {
_incomingFlag = 1;
Serial.println(F("You got an interrupt"));
mySerial.println("ATH0");
}
void setup () {
/* First Start the ...
1
vote
2answers
42 views
Arrays and Functions
How can I return a char array from a function?
char c[] = getFloat(val, valid);
char getFloat(float val, bool valid){
if(valid){
char stringFloat[16];
dtostrf(val, 10, 8, ...
0
votes
0answers
52 views
Two identical functions, one works one doesn't. why?
I'm cross-posting this with the Arduino exchange because I'm not sure if it's a problem with my C or something else entirely.
I'm attempting to communicate over WiFi using the process library (Part ...
1
vote
1answer
30 views
Why is my variable not getting updated?
I have the following snippet of code:
const unsigned long fiveMinutes = 5 * 60 * 1000UL;
unsigned long lastCheck = 0 - fiveMinutes;
unsigned long now = 0;
void loop() {
now = millis();
if ( now ...
0
votes
0answers
69 views
Adafruit Trinket & Ultimate GPS & Google Earth Realtime
I'm using a 5v Pro Trinket that has an Adafruit Ultimate GPS connected and is connected over serial to my laptop. I am not using any fancy parsing code, I'm just letting the GPS spit out the raw data. ...
1
vote
1answer
127 views
Software I2C - Atmega8
I am using Atmega8 with 12MHz crystal, on my breadbord. I can use SDA and SCL pins with default arduino library wire.h, and it works. But I want another pins to use I2C protocol.
I tried library, ...
0
votes
3answers
159 views
AES Simplified for Arduino - Having hard time achieving desired result
Okay, here's the story. I'm not very familiar with how Arduino works but learning. I have a project that requires AES encryption on the Arduino Uno. As per a previous question we managed to figure out ...
1
vote
2answers
51 views
Empty char variable
How do I empty all the values inside a variable char array[256];?
I tried a for loop assigning an empty value at each iteration, but it doesn't compile.
0
votes
4answers
744 views
deprecated conversion from string constant to 'char*'
What does this error means?
I can't solve it in any way.
warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
0
votes
2answers
112 views
Number of elements in an array char
What kind of function can I use to know how many elements are in an array char?
sizeof() gives the number of 'spaces' available so it doesn't work for me.
0
votes
1answer
183 views
Converting float to String
How can I convert a float value into a String object without implementing any library?
I'd like to avoid using char array.
1
vote
1answer
288 views
How to use C Libraries for Arduino code
I have a code in Visual studio that I want to implement in Arduino. But
there is a problem. Many libraries usable in Visual Studio aren't usable
in the Arduino IDE. How can I use them in my Arduino ...
0
votes
1answer
29 views
Conver char value to variable?
I want to pass the preprocessor values(AT commands) to the Serial.println function. Im trying TCP connection using arduino-SIM900A. I've declared all AT commands to each preprocessor variables like ...
0
votes
0answers
53 views
Linear equation solver Arduino Calculator, printing wrong answer
I wrote a code in C to solve equations, but I don't know why some equations that I input into this calculator, give me wrong values, the algorithm is correct because I execute it in C and give me the ...
1
vote
2answers
419 views
How to read code from Arduino Uno to Arduino IDE? [duplicate]
we can upload a code into Arduino UNO from our computers, but how about reading code? Can we read and get C codes from compiled codes from Arduino hardwares? My second question is that will we read ...
0
votes
1answer
143 views
GPS logging on the intel edison breakout board
I'm working on my project car, and I have decided I would like to have a GPS and log some sensors too. I'm just at a bottle neck here, the sensors I have brought pull about 7v each where I can't pull ...
0
votes
0answers
82 views
How do I install a library in Arduino Yun cross compile environment?
A few days ago, I've asked this question.
Thanks to the replies I've received, I've set up a cross compile environment for Yun by following this guide.
I've created a virtual machine with virtualbox ...
0
votes
1answer
41 views
Arduino Yun doesn't link any library
I'm writing code for a project with Arduino Yun. My project is quite simple: it takes a picture with a webcam and saves it in a PNG or JPEG file format. I've already installed the uvc driver for ...
4
votes
1answer
753 views
Basic makefile for avr-gcc
I would like to make a makefile for compiling c programs for the arduino. I am somewhat familiar with make but have never used it with avr-gcc. What is the simplest way I could put the commands below ...
0
votes
1answer
521 views
Reading/writing to Arduino GPIO pins from raw C code
I'm interested in writing a C program without the Arduino IDE and related libraries and am trying to figure out how I can access the GPIO pins for read and write.
My assumption is that the GPIO pins ...
0
votes
2answers
95 views
Arduino UNO code ignores variables selectively
This is the first code I wrote for my UNO R3 just to feel out the functions and I've already got some jankiness. Throughout this description I am referring to the first two if statements one inside ...
5
votes
2answers
717 views
Why doesn't my code work in a function, yet works inline?
I'm trying to write a faster shiftOut function, which does not use the slow digitalWrite. In my code I have the original shiftOut, the new shiftOutFast, and the same as shiftOutFast, but inline. The ...
1
vote
2answers
64 views
cannot convert error with pointers
I write a code to store patterns for LED blinking, but I got this error:
led_basics:39: error: cannot convert 'char (*)[17][2]' to 'char*' in initialization
led_basics:39: error: cannot convert ...
7
votes
3answers
962 views
Writing C Program outside of Arduino IDE?
I like the idea of using the Arduino IDE for simple projects and for getting started with Arduino, but the consensus I've gotten so far is that it is for those who are new to Arduino and/or ...
0
votes
1answer
169 views
Arduino/DuinOS vs Normal C/ARM Programming
I'm trying to understand the difference between programming Arduino hardware (Atel/ARM based) versus 'normal C-based ARM programming'.
My understanding is that the Arduino language is cross-compiled ...
0
votes
2answers
58 views
Problems splitting a string to get authentication and command
Good afternoon,
In a nutshell I'm having some difficulty with splitting and returning part of a string.
Essentially I'm working on the code for transmitting a password (24 character string) and ...
1
vote
2answers
78 views
Why does my LED turn off auomatically after about 18 seconds on its own?
I am using the Arduio Due and I am programing it with Atmel studio 6.2. I have had a HUGE learning curve using this IDE and the Atmel ASF. Nothing is straightforward as it is in the Arduino IDE. None ...
0
votes
0answers
217 views
send SMS for 1 time with arduino GPRS SIM900 if an iput is HIGH (4 Digi inputs)
I faced a problem to send 1 SMS if an input is HIGH,and if it is LOW==> no SMS to send,if LOW to HIGH==> send 1 SMS. this code not working,just sent SMS when I turn the GPRS on,and after nothing is ...
1
vote
1answer
125 views
Sending SMS once with arduino GPRS SIM900 if an input is HIGH
I faced a problem to send 1 SMS if an input is HIGH and if it is LOW no SMS will be sent. The code not working, just sends SMS when I turn the GPRS on and after that nothing happens.
Please check ...
2
votes
3answers
210 views
Arduino error in code
i'm making a project and i came across the follwing error.
Whan i'm trying to compile and upload the code i'm getting those errors:
ShiftRegisterTest1.ino:In function 'int* return_pins(int)'
...
0
votes
0answers
15 views
How to get read user input from DAQ for a given time interval?
I'm using a built-in DAQ simulator. When it opens, it shows 3 different LEDs with 3 pushbuttons, one corresponding to each LED.
I'm trying to read the user input from 3 pushbuttons for a time ...
0
votes
1answer
81 views
Running C for arduino
Is there a compiler that I can use to run C on an arduino or any other way so that I can upload C programs to my arduino?
1
vote
2answers
972 views
Convert uint8_t array to uint32_t array
I have this array of bytes, that I need to convert to an array of unsigned ints. Also the function (btea) that needs it, seems to need a pointer.
I'm currently using reinterpret_cast which seems to ...
4
votes
2answers
681 views
Problem importing a library in .h file
I have following code:
MyApp.ino:
#include "DfRobotLcdShield.h"
void setup() {
}
void loop() {
}
DfRobotLcdShield.h:
#include <LiquidCrystal.h>
When I try to compile, I'm getting the ...
0
votes
0answers
36 views
27 Servo Project, Uno with Adafruit's 16-Channel Drivers
I'm working on a project where I need to be able to control 27+ servos. The problem is that I am unsure how to control them from a computer. I'd love to build a simple program with a user interface ...
3
votes
3answers
410 views
How to calculate phase shift between two square waveforms with Arduino DUE
I have two square wave signals with the same frequency. I want to measure the phase shift between these two signals. There will be a small phase difference between two signals. (0-90 degree) and the ...
3
votes
1answer
488 views
Port manipulation using C code
I'm trying to manipulate the ports of Arduino using C code. I have attached an LED to pin 8 and a tact switch to pin 13 (with a pull down resistor). The code works fine, and the results are printed on ...
6
votes
2answers
869 views
SAM3X8E (Arduino Due) Pin IO registers
How does IO registers of Arduino Due work?
On Arduno Uno just set DDRx, then PINx to read, PORTx to write, I'd like to do the same thing with an Arduino Due, but it has many more registers, such as ...
6
votes
2answers
419 views
Arduino interruption (on pin change)
I use the interrupt function to fill an array with values received from digitalRead().
void setup() {
Serial.begin(115200);
attachInterrupt(0, test_func, CHANGE);
}
void ...