Questions tagged [calculation]

A mathematical determination of the size or number of something.

A mathematical determination of the size or number of something.

16 questions
2
votes
1 answer

Unexpected Behaviour w/ Arduino Uno Calculation

I have a really simple snippet of code wherein the same calculation outputs different values depending on how I do the calculation. The platform that I am running this code on is an Arduino Uno - with an Atmel MEGA328P microcontroller chip. Here's…
Archit K
  • 23
  • 4
2
votes
1 answer

how accurate is the calculation in stm32?

I have a project plan in which there are calculations that require high precision, which later will have calculations with numbers after commas such as 245.5431657288. from some of the information that I read to make the project a success it must…
sagise
  • 31
  • 1
2
votes
4 answers

Issue with incrementing PWM over time

First post here. So I have an issue, which I have identified, but I'm not quite sure how to fix it. I'd really appreciate some input and suggestions. I realize that my "pwmDelta" is the problem, but I am not sure what to do to fix it. I am trying to…
2
votes
1 answer

How to calculate actual Baud Rate and its percent error?

I am using an Arduino Uno, and I need to create a program that calculates the actual baud rate and the percent error for all standard baud rate in Arduino monitor program.
jasmine
  • 21
  • 2
2
votes
4 answers

Reading pressure sensor using Arduino analog

I'm using a Arduino Uno to read pressure and I want to know if I have wired/coded the sensor correctly. I'm not sure I'm getting the correct readings (it could be the right readings - I just want to check I have done everything right). The sensor I…
resolver101
  • 155
  • 2
  • 2
  • 8
1
vote
3 answers

How to filter or eliminate earths magnetic field readings around 3D Magnetic sensor?

Im using the SparkFun MAG3110 3D sensor: https://www.sparkfun.com/products/12670 My application is essentially to make a contactless "magnetic joystick" using a local magnet for accurate and constant 3D position sensing in x, y, x planes of a local…
1
vote
2 answers

C++ Adding Two 16 bit binary numbers together

I am trying to add two 16 digit binary numbers together. Each binary number will have been entered by the user and saved as: int binaryOne[16] and int binaryTwo[16]. Originally, int binaryOne[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; int…
Katie
  • 43
  • 1
  • 7
1
vote
2 answers

When i press a button to subtract 1 from 5 it skips to 3

When i press a button to subtract 1 from 5 it skips to 3, it's the same when I add 1 to -5 it skips displaying - 4 and goes straight to -3. This is the code that i am using: //Testing the use of addition and subtraction with the menu…
Liam
  • 167
  • 1
  • 2
  • 9
0
votes
1 answer

How to execute commands over desired amount of time

I have a program that receives 4 commands on 4 channels to change the color of an LED using mqtt communication. Lets just focus on two of the channels, the time and the red. I am sending a length of time that I would like to complete the color…
0
votes
1 answer

Rounding float number

I want to enable user to change the duration of PWM from 0 to 255, the number should be in minute and increase/decrease with two push buttons. (X) x 255 / 60000 = minute In above example each time plus button pressed value (X) will multiple by the…
ElectronSurf
  • 814
  • 4
  • 17
  • 43
0
votes
1 answer

How to map integer values and round to a count of tens/thousands?

I'm mapping a potentiometer from 0-1023 to 1000-120000 (1 sec to 2 minutes) for a timer, like: maxDelay = map (pot2, 0, 1023, 1000, 120000); Both variables are integers. Now I would like to convert/round values to counts of 10 seconds (a count of…
Emerson
  • 105
  • 1
  • 7
0
votes
2 answers

Using modulo for negative values

I want to wrap a random number using modulo, so that values exceeding 11 starts over from 0 and greater. However, i would also like numbers less than 0 to dividend 11 or less. Please correct me if i'm wrong, but as far as i can tell the modulo…
Erik
  • 271
  • 1
  • 15
0
votes
2 answers

How to calculate step delay?

I'm struggling with get suitable step delay while driving a stepper motor. How to calculate exact step delay for 1.8deg/step stepper motor? Give some example calculation.
user_fs10
  • 187
  • 1
  • 14
0
votes
1 answer

Unsigned long overflow? Or something else?

I have been looking at this for hours and can't figure it out... Take the following code I ran on an Arduino Mega: #define MINUTES 0 #define SECONDS 1 #define MILLIS 2 #define DEFAULT_SELECTED_TURN_DELAY 0, 45, 0 unsigned long calculate_ms(int ,…
Andre Courchesne
  • 676
  • 5
  • 11
-1
votes
3 answers

How do I create boundaries for the possible values of an integer?

I want to create an integer whose total value cannot go beyond a range of numbers when added to and subtracted from. For example, if the "total_value" started at 0 (of a total possible range between -5 and 5), and then, using a button that added 1…
Liam
  • 167
  • 1
  • 2
  • 9
1
2