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

2
votes
1answer
26 views

Informations lost in a string

At first, I sorry if I make some English faults but I'm French. So, I'm making a connection between a client and an Arduino Uno. I receive all data that I need but when I send a response to my ...
0
votes
0answers
28 views

Response to a client

I am new (and French) so, sorry for my English. I am developing an Arduino application with an Arduino Uno and an Ethernet Shield 2. I need to receive some data from a client (like, e.g. which ...
0
votes
1answer
16 views

PWM output voltage too high

I'm experimenting with PWM with the code below, but (according to my analog multimeter) the voltage on the output pins reach up to 5V whilst the largest analogRead(IN1) value is only around 700: ...
0
votes
1answer
34 views

compare uint8_t to char array

I am not actually using ad arduino but an atmel chip. but my question is c microprocessor related I am reading an uart which returns data in the form uint8_t [100] I can print the return just fine, ...
1
vote
1answer
49 views

Unable to replicate Arduino code into ATmega8 code

I am trying to replicate an LTC Audio Decoder code from Arduino Uno into AVR ATmega8 which I got from here. My Arduino Uno code is working great. Here is my Arduino Uno code: #define one_time_max ...
0
votes
2answers
89 views

Issue with IF statement condition

I am using 2 accelerometers connected to an arduino. The code below does not work. > if((acc1 >= 20 && acc1 <= 40) && (acc2 >= 20 && acc2 <=40)) //If acc1 is ...
0
votes
0answers
50 views

Low Power Mode on Blend Micro

I am making a project which envolves an arduino (redbear blend micro) . Basically I followed the getting start procedure to put things working in the IDE and it's done. For now, in order to save ...
3
votes
1answer
32 views

What is the Arduino compiler's version of `__unused` for function parameters?

When I first started with the Arduino environment I noticed that it had File | Preferences | Compiler Warnings set to None, so I set it to All - and there were many, many warnings in the supplied ...
3
votes
1answer
30 views

How to Implement Simple, Quick HMAC on Arduino

Hi I am a research student working on securing the communications in Controlled Area Networks (CANs), and I am using Arduinos to simulate one of these CANs. My goal is to use HMAC to implement ...
0
votes
2answers
85 views

Would rewriting my code in C help reduce RAM usage? [duplicate]

So my program fails to run because there is not enough room for my variables as well as the Arduino Core and Stack. I can't find any more ways to optimize my program so I'm thinking about just ...
0
votes
0answers
17 views

Modscan Request format

I have downloaded the modbus RTu library from below link. The code seems working for me. I Need help in Modify sending request format with same library function. Here is My part of code. I am also ...
1
vote
1answer
37 views

Reading a .csv file element wise

I'm fairly new to arduino programming and C/C++. I would like to read a .csv file element wise, and send each element via. a nRF24L01 tranceiver to a raspberry pi. Right now I'm able to read the .csv ...
1
vote
0answers
23 views

Modbus Protocol RTU

I have simple code working on Serial Communication asn below. With Same data i would impliment Modbus protocol> I have Used Modbus library for arduino earlier which works fine with 9600 baudrate and ...
0
votes
2answers
65 views

Converting an array of uint8_t to a char array

I'm trying to convert this array uint8_t data[] in the code below to a character array to be printed in the serial monitor. However, when I run this code I see a blank screen. What am I doing wrong? ...
1
vote
0answers
37 views

Serial Request error

I am working on arduino Uno board.I am trying to send request Serially from out Side using docklight.I am sending COmmand is request send every 5S to 10S and get response.When i tested this code with ...
0
votes
1answer
33 views

Storing integer into character buffer

I have my Arduino code as below.I am trying to send Serial request and get response for it. I can able to send request mentioned in Setup function and also able to switch cases. Problem i am facing ...
5
votes
2answers
266 views

Arduino's digitalWrite, precautions for direct port manipulation?

I stumbled upon this piece in digitalWrite. I'm unsure why clearing interrupts and setting/resetting SREG is neccesary here. Can anyone shed a light on this? uint8_t oldSREG = SREG; cli(); if (val =...
0
votes
2answers
18 views

MPU6050 acceleration values not 16-bit?

I'm looking at the little code snippet from this (many other projects also use similar code): void loop(){ mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); ax = map(ax, -17000,...
0
votes
2answers
75 views

How to compile an official VS1003 / VS1053 example for Arduino / ESP8266?

Have anyone ever successfully run any of the official playback and recording examples for VS1003 or VS1053 on Arduino / ESP8266? I mean, I was able to play sound with VS1003, but I just can't make the ...
1
vote
1answer
59 views

ESP8266 not able to communicate over serial connection with arduino UNO

This is the code I uploaded in Arduino UNO: #include<SoftwareSerial.h> SoftwareSerial ESP(2,3); // RX, TX //ESP RX-->3(UNO) TX-->2(UNO) void setup() { // Open serial communications and ...
0
votes
0answers
46 views

PID Implementation on DC Motor Speed Control

The motor will only be very slightly loaded.There is no particular physical application, the point here is to show proof of principle. Since the motor control is unidirectional, I plan on using a ...
0
votes
1answer
42 views

Serial command request

#include <avr/wdt.h> #include "Timer.h" #include"glob.h" int LED = 13; Timer t; String Old_string; String New_String; String Received_String; const byte numChars = 32; char receivedChars[...
0
votes
1answer
29 views

Arduino: put string through variable in array

I have a problem and I can't fix it. I'm busy with an java to arduino project. Java writes a string using writeString(); Arduino reads the serial monitor and put the incoming string into a function. ...
0
votes
1answer
57 views

String comparison

[![Out put file][1]][1]I have simple code written in arduino. I am sending serial command via comma separated values. I have string in format. if the first 2 comma separated value from PC matched then ...
0
votes
1answer
24 views

Wifi rssi converting char[] to uint8_t

I am trying to get RSSI of a network without connecting to it directly but I get an error " error: cast from 'const char*' to 'uint8_t {aka unsigned char}' loses precision [-fpermissive]" char ...
0
votes
2answers
44 views

How do I pass an Int Array into void for a foreach loop?

I know its probably an odd question...but I found a workaround for a foreach loop in C. I have a whole bunch of int arrays that I would like to be able to pass into a void, which has that foreach loop ...
0
votes
1answer
58 views

Arduino serial non-blocking

I'm writing an Arduino program to communicate with another module using RS485, so I need to control data flow with one pin. But when I set the pin to HIGH (line 88) it almost instantly falls (as you ...
1
vote
0answers
25 views

Why am I only receiving the first address byte? (I2C Protocol)

Expecting the slave to ACKnowledge and return data, but it does not. This is my protocol. This is my Datasheet. Also FYI I'm on an Arduino Fio but I am not inheriting the Arduino library. #include &...
1
vote
0answers
72 views

Error with libraries after setting up Code::blocks to work as an arduino IDE

I followed this guide: http://arduinodev.com/guide-to-arduino-development-environment-codeblocks/ Everything seemed to work until I compiled the example code: #include <Arduino.h> /* Turns ...
0
votes
1answer
48 views

Why does this code show me a lot of space?

I want to make a 4hz reading of GSR and temperature, in the following format for every second: 697,20.8744 696,20.86521 695,20.8653 699,20.8777 The print, in python, would be print(GSR+","+Temp) ...
0
votes
2answers
55 views

Removing Element From Array While Keeping Order

I'm building a wireless mechanical keyboard. There is an array of 6 elements that stores the keys pressed by the user (since 6 is the max number of keys you can send at once over Bluetooth). An ...
0
votes
1answer
30 views

Why does this method return an unprintable character, how do I convert it to display correctly?

Page 14 says that the method should return the value 'h17' typedef struct { uint8_t data; uint8_t timestamp; unsigned char crc; } tData; int main(void) { unsigned char* tempData = "snap"; ...
1
vote
1answer
33 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 ...
0
votes
2answers
18 views

Stop multiple presses in vex bumper (Unexpected bumper output) [closed]

According to Official documentation of the Vex Bumper, it states that the bumpers will cause: the robot sometimes [counts] a press twice. This issue is also caused by the robot counting too fast ...
3
votes
1answer
56 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
47 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
55 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
41 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
121 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
1answer
779 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
226 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
141 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
35 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
77 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
66 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
50 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
85 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
52 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
93 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 ...