C is a procedural programming language which is widely used in embedded systems. PLEASE NOTE: Arduino is typically programmed in C++, not C.

learn more… | top users | synonyms

1
vote
1answer
13 views

How do I use SNAP protocol, correctly?

I've reviewed the documentation I'm still a little lost when it comes to applying the functions. Each of the redundancy check methods take in an unsigned char and return an unsigned char. Shouldn't ...
1
vote
2answers
9 views

Stop multiple presses in vex bumper (Unexpected bumper output)

According to RobotC's own documentation, it states that the Vex Bumpers will: the robot sometimes [counts] a press twice. This issue is also caused by the robot counting too fast and as the limit ...
3
votes
1answer
24 views

Using map for DC motor instead of servo

I am trying to use map command which is used to power servo 180 degrees as the potentiometer moves... in fact what i want to do is just when i adjust my potentiometer to zero; stop the dc motor then ...
0
votes
2answers
42 views

Fastest way to test if two integers differ by 4 or equal to each other

I'm searching for the fastest way to test if two integers are equal or differ by 4. The integers can be positive, negative and equal to zero. They are between -1000 and 1000 and are exclusively ...
0
votes
1answer
41 views

How to convert array of chars to array of ints?

I have a rather newbie question but I can't figure it out. Lets say I have this char array: char array[] = "10,11,12,1,0,1,0"; How can I convert it to an array of int like this? int arrayINT[] ...
0
votes
1answer
27 views

Understanding the contents of a library in C

So this is a question not just about the #include but most all includes you find while programming in C. So I understand a library is prewritten code and when you include that library are you able ...
1
vote
1answer
62 views

Problem reading an EEPROM chip using I2C protocol

I am trying to read an EEPROM chip that supports the I2C protocol (cannot tell the IC model number as it is not printed). For sure it supports the I2C protocol, since I wrote a code to detect it using ...
-1
votes
1answer
53 views

Simulated Arduino displaying same temperature over and over again

I'm new to Arduino so im still getting used to it...ineed to read the temperature of temperature sensor in arduino. Whatever i do, it keeps displaying same temperature(don't even know if that's wrong, ...
0
votes
0answers
128 views

ESP8266 (Wi-Fi Module) interfacing with PIC 16F or 18F microcontroller

Has anyone interface PIC16f877A or PIC18f4520 or any other PIC microcontroller with wifi ESP8266 Module, need some sample code to send and hit url using TCP connection command. My hardware part is ...
6
votes
4answers
161 views

Arduino: How to get the board type in code

I want to write a sketch that can be compiled on different Arduino boards. I want to display on the PC which board is currently connected. This means that the user connects the PC via USB cable to ...
1
vote
2answers
77 views

How to write array of functions in arduino library?

I've nine functions each of type void as follow: void zero(); void one(); void two(); void three(); void four(); void five(); void six(); void seven(); void eight(); void nine(); I've put all these ...
0
votes
1answer
14 views

How to append float value of into a string ?

I have a float variable lng = 33.785469 and lat = 78.126548. Now can I convert them to String and append in a String variable "my_location" as "your location is \nlng = 33.785469 \nlat = 78.126548". I ...
0
votes
1answer
48 views

Timer/Counter programming Arduino

I'm trying to blink an LED on an ATMega328P (same MCU as Arduino I think..) using the internal timer but I'm stuck since it doesn't seem to light the LED at all.... #include <avr/io.h> ...
0
votes
2answers
50 views

Arduino & ARM - Replacement for avr-libc?

There is very cool avr-libc library that provides direct access for all functions of AVR microcontrollers. I'm writing a project for Arduino Due and I want to use timers and ISRs directly. Is there a ...
1
vote
1answer
41 views

Atmega328 PWM frequency setting not working

I have an Arduino UNO with Atmega 328 SMD, and I am trying to use PWM, but by setting registers, not using analogWrite(). My code is: DDRD |= (1 << PORTD6); //Setting pin D6 as output OCR0A = ...
2
votes
1answer
76 views

Arduino can't multiply?

I have a value I'm taking from a sensor module, which is 2500 when the sensor is facing a light source. This reads to my code and can be saved perfectly fine. When I try to find the weighted average ...
-2
votes
1answer
47 views

c expected ; before ) token [closed]

void GravaFicheiros(CONFERENCIA *co) { int i, ii, iii; FILE *fp; fp = fopen("grabameisso", "wt"); fprintf (fp, "%s\n", co->nomeconf); int k = NSessoes(co); fprintf (fp, ...
3
votes
1answer
48 views

Arduino throwing error while using modbus RS485 code

I have been trying to make a communication with my industrial drive. All I want to do is read a few values of drive, like current, voltage etc. For that I am using a library: I don't understand why ...
1
vote
2answers
31 views

Check the value of character variable

I'm writing some code for Arduino and I'm not sure if I'm checking the value of this character variable correctly. Can you please tell me if this is correct: const char* front = "front"; const char* ...
1
vote
1answer
64 views

“EVERY_N_MILLISECONDS”

One of the FastLED examples that I've seen was using code that looks like this: EVERY_N_MILLISECONDS( 300 ) { transition_step(); } I've copied it and successfully used it in the same context - ...
1
vote
1answer
42 views

Using an Arduino as the processor for a computer-mouse-like speed detector

I'm looking at making a pretty cheap and easy odometer, eventually for an electric car or similar vehicle. My idea is to implement a big computer mouse, and track the speed with that: a computer ...
0
votes
1answer
30 views

One time execution of a variable incrementation

As part of a larger script intended for a very simple arduino "synthesizer" I am trying to increment the amount of cycles a melody will be played once a key is pressed (the key in turn passes a value ...
1
vote
4answers
147 views

Few questions related to programming microcontrollers

I'm learning "Arduino" (I don't have previous knowledge of microcontrollers). I have few questions: What is the difference between programming a microcontroller in C and programming in "Arduino?" Is ...
0
votes
1answer
73 views

Correct solution for “multiple definition of” compile error

I'm in the process of trying to take this demo sketch and extract the necessary bits into a modular library that can be included in other sketches. Here's where I'm at so far. Here's the test sketch ...
0
votes
1answer
90 views

Arduino does not work

When I try to upload a sketch to my Arduino Uno R3 then sometimes I get the following issue: At the beginning the RX LED flashes three times and then I get errors: avrdude: stk500_recv(): ...
1
vote
0answers
58 views

Teensy 2.0++ SDA SCL pins not accesible using ARDUINO software

Hi I was looking to interface Teensy++ 2.0 with MPU6050 for a simple IMU project. I have done this previously using Teensy 3.1 by trying the project of kriswiner however I also wanted to try it out on ...
0
votes
2answers
110 views

Compare const char * to const char

Using ArduinoJson I have assigned a value such as; const char* id = root["id"]; in the original JSON id was "1" if (strcmp(id, "1") == 0) { // this executes } I have an array of structs that ...
4
votes
1answer
89 views

Combine bits from two ports into a single byte

I'm attempting to read the values of 8 pins at a time into a byte. The obvious answer to this seems to be the Port registers, however with the way the Arduino is wired, I'd have to split my read ...
5
votes
2answers
201 views

Arduino DC motor causes disturbance. What can cause it?

I tried to fix this problem the whole weekend but, after no success I decided to post it here. I would really appreciate any help. The problem The Wi-Fi module activates the DC motor and lets it run ...
0
votes
3answers
71 views

Arduino C, Led > binary alternative all lights

I'm trying to alternatively have a random int generate a binary number with 4 lights. This is my current code, However, it seems that all the lights(leds) go on, I don't think the minus option ...
1
vote
1answer
41 views

exit(0) function shows up an error

So I have been trying to write a code where I use the millis() function to print the milliseconds of on-time of the board using Serial. But the condition is I want to stop printing the value once it ...
1
vote
0answers
79 views

Serial Communication, Arduino and Rpi , C library

I am currently working on a project on serial communication between RPi and Arduino. This is the code that I am using from RPi side, it's in C: int main() { //------------------------- //----- ...
0
votes
1answer
369 views

ESP 8266 with sdk 1.5

By compiling using sdk v1.5 i got following error.Any idea how to resolve it? mingw32-make.exe -f C:/Users/abc/worksorg/mesh/Makefile all AR build/app_app.a LD build/app.out ...
0
votes
1answer
68 views

Arduino Simple Task - sweeping a buzzer and led, not working as expected

Use of the tone() function will interfere with PWM output on pins 3 and 11 (on boards other than the Mega). UPDATE: IT seems that there is a problem using pin 11 and 13 together but if I use a ...
-2
votes
1answer
114 views

Peer to peer communication

Hello guys , I want to perform a mesh network between 3-4 modules using ESP8266 . Any one have idea how to do it?
0
votes
2answers
84 views

Interface pressure Sensor

Hello folks, I am using G1/4 Pressure Transmitter Sensor 0-1.2 MPa sensor can you guide for programming part.The conversion from bar to pascal or bar to Mpa or pascal to psi.Though I am ...
0
votes
1answer
54 views

Popen command restarts arduino [duplicate]

So I am trying to make a Mac OSX program with Cocoa that will be able to control my Arduino via serial. I currently have the C command popen("echo 7 > /dev/cu.usbmodem1411", "r"); to try to ...
0
votes
2answers
395 views

Error in my Arduino code “ error: expected unqualified-id before ‘if’ ”

I cant seem to find this error is: elevator_bug_2.ino:38:1: error: expected unqualified-id before ‘if’ Here is the code: // these constants won't change. They are the // lowest and highest ...
1
vote
1answer
115 views

Timer interrupt won't work if the ISR is not set

I am using an Arduino Mega 2560. I have a code in a c file, that looks like this: #include <avr/io.h> /* for DDRB, PORTB, etc. */ #include <util/delay.h> /* for ...
0
votes
0answers
73 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 ...
0
votes
1answer
49 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
122 views

What wrong with that code? [duplicate]

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
49 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
45 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
3answers
44 views

Arduino ethernet need help with game logic!

I'm making a game where there are three LEDs and three buttons: 1 LED for 1 button. One has to press the button that has its LED lit. If it is correct, another (random) LED will light up and the game ...
-1
votes
2answers
119 views

arduino project for c programming language [closed]

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
62 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
117 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
57 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
55 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, ...