Hi,
I have a basic Serial interface working, where a user can input values and they are saved to eeprom.
This is working as expected.
The value they enter will then be used to generate a PWM value on an analog pin with AnalogWrite.
If I want a value less than 100, the way I have coded the serial interface requires a 0 to be added before the value. IE 050.
The question which I cannot find an answer to googleing is:
can I use analogWrite(A1,050) ? for example, will it have the same effect as analogWrite(A1,50)?
or do I need to clip the leading 0 off before using it in analogWrite?
You can use it but it won't do what you expect because a leading zero is an indication that the value is in Octal. Try Serial.println(050); to see what I mean
However, without seeing your full sketch it is impossible to say whether the user entering 050 will cause a problem or not because we don't know what data types you are using and how they are stored to EEPROM
I will do, but i thought it may throw a spanner in the works and thought id ask before I get that far in the code and therefore be able to tackle it before spending hours scratching my head over it not working right.