• Sketch for generating test pulses for the power meter

    11/30/2017 at 22:29 0 comments

    //Sketch to generate timing pulses to test the power meter (an attiny85 is used, but any arduino will do the job)

    /* 
     
     program to simulate the signal as generated from aa speedometer pickup by an arduino duemillenova
     it will be fed into another arduino that contains the power measuring algorithm
     */

    const int speedpin = 2;
    void setup () {
      pinMode(speedpin,OUTPUT);

      digitalWrite(speedpin, HIGH);
    }

    void loop()
    {   for (int i=1;i < 40;i++)
      { 
        digitalWrite(speedpin, LOW);
        delay(1);
        digitalWrite(speedpin,HIGH);
        delay(400);
      }
      for (int i=1;i < 10;i++)
      
      {
        digitalWrite(speedpin, LOW);
        delay(5);
        digitalWrite(speedpin,HIGH);
        delay(400+i*10); 
      
     }