Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [map]

The tag has no usage guidance.

0
votes
1answer
27 views

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/...
1
vote
4answers
213 views

How to boil down analog input to just three cases?

I am investigating the use of a 3-position-switch for one of my projects to switch between different settings using just one analog input pin. For the three positions I am using ground/0V, ~2.5V (via ...
2
votes
1answer
252 views

Arduino std::map returning random values

I'm working with an arduino UNO. I would like to be able to send it set and get commands over serial and have it update class data class members accordingly by key value pair. I spoke to users in the ...
-1
votes
1answer
152 views

What is the definition of these arduino commands, and how do they affect the circuit? [closed]

I don't know if I am allowed to ask this question because really I could just look this up on google. The reason I'm asking here is because in google when you look up the definitions for the following ...
1
vote
2answers
3k views

Explanation of the formula of the map funtion

Can someone please explain (mathematically) how the formula for the map function actually came to light? I have given the code of the map function below. You can see that it uses a formula to "map" ...
4
votes
2answers
6k views

Why is the constrain function used after the map function?

I am reading some sample code and they use this method of mapping data from IR sensors: sensor1 = analogRead(0); adj_1 = map(sensor1, s1_min, s1_max, 0, 255); adj_1 = constrain(adj_1, 0, 255); ...
0
votes
1answer
771 views

Does the map() function works on an ATtiny85?

I have a working project on Arduino Uno.Now I want to shrink my project using an ATtiny85. Before purchasing an waiting for the shipment to arrive, I want to make sure that my whole code will run on ...
0
votes
1answer
1k views

Fade LED strip using proximity and map() function

I'm using a sonar sensor to detect proximity, and need to control the brightness of an LED strip in direct relationship to the distance detected. For example, as someone moves toward the sonar, the ...
2
votes
3answers
1k views

Arduino starter kit servo is shaking

In the example of the arduino starter kit the point is to use a potenciometer to control a servo. The code is angle = map(potVal, 0, 1023, 0, 179); The output in the serial potVal: 1023, angle: ...
2
votes
2answers
585 views

Is it possible to transmit Longitude and Latitude via RF433MHz?

I want to make a drone project, and to that I will use arduino as the platform. My plane is to use a Play Station controller to control the Drone in the air. In addition to that I want to connect a ...
6
votes
4answers
2k views

What's the most efficient implementation of map(x,0,1023,50,250)?

I recently noticed how the map() function in Arduino was bulky in both terms of flash space used and time taken to execute, largely because it deals with long and involves a division and ...