Demo entry 6360468

oscopeTest

   

Submitted by anonymous on May 01, 2017 at 19:07
Language: Arduino. Code size: 615 Bytes.

//OScopeTest.ino
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

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

void setup() {
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("Potential:");
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(read_pin, INPUT);
}

void loop() {
    lcd.setCursor(0,1);
    val = analogRead(read_pin);
    val = map(val, 0, 5, 0, 1023);
    lcd.print(val);
    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).