Demo entry 6358822

ArduinoOscilliscope

   

Submitted by anonymous on Apr 26, 2017 at 20:22
Language: Arduino. Code size: 444 Bytes.

//OScopeTest.ino

int led = 13;
int read_pin = 0;
float val = 0;

void setup() {
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(read_pin, INPUT);
}

void loop() {
    val = analogRead(read_pin);
    val = fmap(val, 0, 1023, 0, 5);
    Serial.println(val);
}

float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
 return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).