Hello ALL, I am trying to use on of these "functions" (if both really are) and need a little help please.
I went to the Reference and got the follwing code from there.. so NOT my code but from here.
Here's what was given:
int val;
void setup() { // begin setup
Serial.begin(9600); // okay, above is MY CODE, but needed.
val= map(val, 0, 800, 0, 16000); // I put in MY numbers .. tried reversing numbers, as we;; ![]()
Serial.print("Mapped value of 550 is "); Serial.println(550, val);delay(100000);
// val = map(val, 0, 1023, 0, 255); // the exact original code
// analogWrite(9, val);
The ERROR: When it prints to serial monitor I get either a small box for val or an &.
I was expecting a NUMBER between 0 to 16000 or the other way around.. 0 to 800 for val.
Now for fscale: I put in a "new" program ..
int j; int scaledResult; /// MY needed code
void setup() {
// put your setup code here, to run once:
}
void loop(){
for (int j=0; j < 200; j++) {
scaledResult = fscale( 0, 200, 0, 200, j, -1.5);
Serial.print(j, DEC);
Serial.print(" ");
Serial.println(scaledResult, DEC);
}
}
THE ERROR: 'FSCALE' NOT DECLARED IN THIS SCOPE