Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Simulasi Elkadaya
- */
- #define to_triac 3
- #define interup 2
- #define potensio A0
- int x;
- void setup() {
- Serial.begin(9600);
- pinMode(to_triac, OUTPUT);
- pinMode(potensio, INPUT);
- attachInterrupt(digitalPinToInterrupt(interup),alphaa, RISING);
- }
- void loop() {
- x=analogRead(potensio);
- x=map(x,0,1023,0,10000);
- Serial.println(x);
- }
- void alphaa() {
- delayMicroseconds(x);
- digitalWrite(to_triac,HIGH);
- delayMicroseconds(100);
- digitalWrite(to_triac,LOW);
- }
Advertisement
Add Comment
Please, Sign In to add comment