MosfetIRLD024 \ Learning \ Wiring ALPHA 1.0
Author: Hernando Barragán
Description: Wiring is an electronic sketchbook and hardware electronics for developing ideas. It is a context for learning fundamentals of computer programming and prototyping with electronics within the context of the electronic arts.
Keywords: Wiring, Processing, Interactive Media, Electronic Arts, Programming, C, C++, Hernando Barragán

Search wiring.org.co:

This example is for Wiring version 0023+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.

Switchng a 12V lamp with an International Rectifiers IRLD024 Mosfet Switch by BARRAGAN http://barraganstudio.com
A Mosfet is s special kind of transistor switch used to handle higher loads than the Wiring board can handle by itself. Logic-level MOSFETs can be connected directly to a digital output pin. In this example the Wiring board is blinking a 12V lamp by using an IRLD024 Mosfet connected to the digital Pin 0 Don't forget to tie together the Wiring GND and the Lamp 12V power supply GND.

    int mosfetPin = 0;  // Mosfet Gate pin connected to the Wiring I/O board pin 0

    void setup()
    {
      pinMode(mosfetPin, OUTPUT);  // sets the digital pin as output
    }

    void loop()
    {
      digitalWrite(mosfetPin, HIGH);  // sets the Lamp on
      delay(1000);                    // waits for a second
      digitalWrite(mosfetPin, LOW);   // sets the Lamp off
      delay(1000);                    // waits for a second
    }