Map value, unknown how to in this case

I have a sketch that sends OSC messages using a ESP8266, potentiometer and the OSCBundle.h It works as expected and I am able to monitor the incoming messages on a PC. I need to map the value of the potentiometer which I have done successfully in past projects. I'm having problems wrapping my head around how to do it in this case. I tried implementing the map value a few different ways and always end up creating code errors that i end up chase down a rabbit hole. Could I please get some help,

I would like to understand how to map the init32_t value from 0-1024 to a range of my choosing say the typical 0-255 or 0-127. the way this line is structured and how to implement the map function is confusing me.
bndl.add("/Volume/0").add((uint32_t)analogRead(0));

Thanks You

the entire code is here

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <SPI.h>    
#include <OSCBundle.h>

char ssid[] = "ssid";        
char pass[] = "pass";                   

WiFiUDP Udp;
const IPAddress outIp(10,8,1,214);
const unsigned int outPort = 9999;
const unsigned int localPort = 8888;


void setup() 
{
    Serial.begin(115200);
    WiFi.begin(ssid, pass);
      while (WiFi.status() != WL_CONNECTED)
        delay(1000);
    Udp.begin(localPort);
    Serial.println(WiFi.localIP());
    Serial.println(Udp.localPort());
}
void loop()
{
    OSCBundle bndl;
      bndl.add("/Volume/0").add((uint32_t)analogRead(0));
        Udp.beginPacket(outIp, outPort);
          bndl.send(Udp);
        Udp.endPacket();
          bndl.empty();
    delay(10); 
}

You are passing a value to the add() function, rather than putting in the analogRead() function, put in the map() function

bndl.add("/Volume/0").add((uint32_t)map(analogRead(0),0,255));

I get error at compiling ,,

too few arguments to function 'long int map(long int, long int, long int, long int, long int)'

i tried this also

bndl.add("/Volume/0").add((uint32_t)map(analogRead(0)0,1024,0,255));

and got error

expected ')' before numeric constant

zeostjh:
i tried this also
bndl.add("/Volume/0").add((uint32_t)map(analogRead(0)0,1024,0,255));

and got error
expected ')' before numeric constant

You forgot a comma after "analogRead(0)".

Thank you Sir,

I get an unexpected result with the map value now. 0,1240,0,255 results in a range of 0-211 in my OSC monitor. when I take away the map function I get the expected range of 0-1240 any ideas as to what could be causing this? i have temp fixed it by mapping 0,1240 to 0,154 which ends up being the range I'm looking for 0-127

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <SPI.h>    
#include <OSCBundle.h>

char ssid[] = "#";        
char pass[] = "#";                   

WiFiUDP Udp;
const IPAddress outIp(10,8,1,214);
const unsigned int outPort = 9999;
const unsigned int localPort = 8888;

void setup() 
{
    Serial.begin(115200);
    WiFi.begin(ssid, pass);
      while (WiFi.status() != WL_CONNECTED)
        delay(1000);
    Udp.begin(localPort);
}
void loop()
{
    OSCBundle bndl;
      bndl.add("/Volume/0").add((uint32_t)map(analogRead(0),0,1240,0,255));
        Udp.beginPacket(outIp, outPort);
          bndl.send(Udp);
        Udp.endPacket();
          bndl.empty();
    delay(10); 
}

No coffee yet but

1240 is not 1024.

Your numbers look like you've really used 1240 instead of 1024.

HTH

a7