Powering an electromagnetic lock/strikeplate


hi all--experienced programmer noob arduino , electronics, , i'm hoping (anyone!) can help. 

i'm trying use arduino control electromagnetic lock.  setup in attached image.

i'm sure i'm being silly can't figure out:

when connect lock either 5v or 3.3v , ground, unlocks should.

when connect pin--nada.  missing something?  i've tried both analogwrite , digitalwrite (see code below).

help!  , thanks!

code: [select]


#include <servo.h>

servo servo1;

const int led = 13;
const int button = 7;
//const int lock = 0;
int val = 0;

void setup() {
  serial.begin(9600);
  pinmode(led, output);
  pinmode(led, output);
  pinmode(button, input);
}

void loop(){

  val = digitalread(button);
 
  if (val == 1) {
    serial.print(val);
    digitalwrite(led, high);
//    neither working!~
//    analogwrite(9, 255);
//    digitalwrite(9, high);

   
  }
  else {
    serial.print(val);
    digitalwrite(led, low);
//    analogwrite(9, 0);
//    digitalwrite(9, low);     
   
  }

 
}


it arduino incapable of providing enough current operate lock, , may have damaged arduino.
use relay or transistor.


Arduino Forum > Using Arduino > General Electronics > Powering an electromagnetic lock/strikeplate


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62