Amp Pot B5K (B5K) [S027]
https://www.youtube.com/watch?v=7J1AMx28ROs
* Specs
5k
2W @ 70°C ambient
Non-rotational key
Temp. range: -55°C to +120°C
Shaft length: 0.875"
Shaft dia.: 0.25"
Mounting hole: 0.375"
Max. panel thickness: 0.25"
* Contents
- Connect
Potentiometer
LEFT - 5V
MIDDLE - A0 (OUT)
RIGHT - GND
Servo
Black - GND
Red - 5V
Red - D12
- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
LiquidCrystal_I2C lcd(0x27,20,4); // LCD2004
Servo myservo;
int servoPin = 12;
int potPin = A0;
int val;
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("start LCD2004");
myservo.attach(servoPin);
delay(1000);
lcd.clear();
}
void loop()
{
val = analogRead(potPin);
val = map(val, 0, 1023, 0, 179);
lcd.setCursor(0,0);
lcd.print("S027:B5K");
myservo.write(val);
lcd.setCursor(0,1);
lcd.print("pos0~179=" + (String)val + " " );
delay(10);
}
'2) Sensor > Potentiometer' 카테고리의 다른 글
3362P 10K Trimmer Potentiometer (3362P-10K) [S091] (0) | 2016.09.18 |
---|---|
3296W Multiturn Trimmer Potentiometer (3296W) [S089] (0) | 2016.09.18 |
Linear Potentiometer B1K~B1M (B1K~B1M) [S070] (0) | 2016.09.18 |
Slide Pot 10K Module [S061] (0) | 2016.09.18 |
Taper Rotary Potentiometer B10K (B10K) [S060] (0) | 2016.09.18 |