Can someone please help me out with the code for pulse generation using arduino, where the pulse width vary with the voltage that is connected to a battery I Basically want to represent the battery's status based on the width of the pulse. like in, if the battery has 6v initially then the width of the pulse is displayed in the CRO and if the battery is charged then the increased width have to be displayed accordingly, really need halp with this Thank You in adance
Thankyou for the reply ....Is there any way to make the arduino uno board read the variable pulsewidths from the 555 timer circuit ie interfacing the 555timer with the arduino uno board??
Please help
void setup()
{
 Serial.begin(115200);
 Serial.println("Start ");
}
void loop()
{
 int raw = analogRead(A0);
 uint8_t width = convert(raw);
 analogWrite(9, width);
Â
 Serial.print(raw);
 Serial.print("\t");
 Serial.println(width);
 delay(100);
}
uint8_t convert(int val)
{
 return (1023 - val)*(1023 - val)/4096; // replace with a formula you like
}
check multimap() to make a non linear mapping of voltageIn to PulseOut.