( ! ) Warning: Declaration of Suffusion_MM_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = NULL, $id = 0) in /var/www/public/arduino/wp-content/themes/suffusion/library/suffusion-walkers.php on line 39
Call Stack
#TimeMemoryFunctionLocation
10.0003342592{main}( ).../index.php:0
20.0004344280require( '/var/www/public/arduino/wp-blog-header.php' ).../index.php:17
30.627126857776require_once( '/var/www/public/arduino/wp-includes/template-loader.php' ).../wp-blog-header.php:19
40.629626872304include( '/var/www/public/arduino/wp-content/themes/suffusion/single.php' ).../template-loader.php:98
50.629626872304get_header( ).../single.php:6
60.629626872576locate_template( ).../general-template.php:41
70.629626872656load_template( ).../template.php:671
80.629926884416require_once( '/var/www/public/arduino/wp-content/themes/suffusion/header.php' ).../template.php:722
90.633726894560wp_head( ).../header.php:50
100.633726894560do_action( ).../general-template.php:2879
110.633726894832WP_Hook->do_action( ).../plugin.php:478
120.633726894832WP_Hook->apply_filters( ).../class-wp-hook.php:312
130.644826939224Suffusion_Framework->specific( ).../class-wp-hook.php:288
140.645026939416require_if_theme_supports( ).../framework.php:230
mai 162014
 

Ok, this is an easy one to make. We are going to use a hall effect switch to turn the Arduino UNO’s built-in led on and off with a magnet.

We will be using the Allegro Microsystems A1120EUA Hall Effect Switch

  • Connect pin 1 of the switch to the Arduino +5V supply (red wire)
  • Connect pin 2 to 0V (black wire)
  • Connect pin 3 to Arduino input pin 12 (orange wire)

A pull-up resistor is required between pin 1 and pin 3 to pull-up the switch’s output to +5V.

When the switch detects a magnet, it will pull it’s output pin low, which we can easily detect on the Arduino board.

hall-effect-breadboard

Here is the Arduino sketch

/*
 Hall Effect Switch
 
 Turns on and off a light emitting diode(LED) connected to digital  
 pin 13, when Hall Effect Sensor attached to pin 2 is triggered by a magnet
 
 Hall effect sensor used is the A1120EUA from Allegro Microsystems
 
 This example code is in the public domain.
 
 http://www.hobbytronics.co.uk/arduino-tutorial8-hall-effect
*/

// constants won't change. They're used here to set pin numbers:
const int hallPin = 12;     // the number of the hall effect sensor pin
const int ledPin =  13;     // the number of the LED pin
// variables will change:
int hallState = 0;          // variable for reading the hall sensor status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the hall effect sensor pin as an input:
  pinMode(hallPin, INPUT);     
}

void loop(){
  // read the state of the hall effect sensor:
  hallState = digitalRead(hallPin);

  if (hallState == LOW) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(necesar)

(required)