All Arduino Boards That Exist  List ‚Ė∑ 2021

Nowadays there are many advances that have been created referring to the area of ‚Äč‚Äčelectronics and programming, one of them is Arduino.

Arduino is created in 2003, and it is a device that is being used by students of the careers: electronics, programming and mechatronics to put your knowledge into practice.

All the advances that have been made to date and those that will continue to have are extraordinary, since, for being a free software and hardware, students or fans of this area are at liberty to modify the code and the Arduino board, adapting it in this way to the requirements of your projects.

Get to know all the Arduino boards developed until today that you can buy to learn how to develop your own devices

Before entering the topic of the different Arduino boards that exist, it is necessary, to make known the basic concepts to get acquainted more quickly with the subject, since, as we advance, we will see it reflected in the characteristics of each plate.

Among them are the following:

  • Microcontroller: it is an integrated circuit capable of processing information. It has various functions, between them control the input / output elements, as in the case of computers.
  • Input voltage: it should be 7 to 12V.
  • Digital pins: these types of pins receive values ‚Äč‚Äčof either 0v or 5v.
  • Analog pins: They can be used to read voltage values ‚Äč‚Äčfrom 0 to 5v, In Arduino it has a notation from A0 to A5.
  • Speed ‚Äč‚Äčclock: Arduino boards have an internal speed, as more functions are added, the clock speed decreases.
  • Flash memory: It is the memory of the program, its size varies depending on the microcontroller, some can be 16kb while others are 32kb. When developing a program, the types of variables must be taken into account, to use the least amount of memory possible.
  • PWM channels: pulse width modulation channels they are used to obtain analog results by digital means.
  • Voltage regulator: stabilizes the output current, fulfilling the function of converting the voltage so that it can be used in electronic components.

Arduino boards developed to date

Knowing what we mentioned above, we proceed to visualize the list of the different Arduino boards developed to date:

ARDUINO UNO R3

ARDUINO UNO R3

It is one of the best known plates, and It is characterized by having an ATmega328 microcontroller, its input voltage is equal to or greater than seven and can be capped at twelve volts. Also, Arduino UNO board integrates with 6 analog inputs, and 14 digital I / O pins. Among all its qualities, the ones that stand out the most are its 32 KB memory and its 16 MHz clock speed.

ARDUINO MEGA 2560 R3

ARDUINO MEGA 2560 R3

This Arduino board, unlike the previous one It offers us a greater capacity reaching up to 256 KB of flash memory. The voltages of the drivers are maintained, but the number of pins is greater, being 54 in / out, where 14 of them are PWM.

ARDUINO LEONARDO

ARDUINO LEONARDO

LEONARDO is the Arduino board, it has a controller suitable for many programming, its version being the ATmega32u4. It only has 20 digital input / output pins, of which seven are used as PWM channels and twelve for ADCs. The speed of its clock allows the correct execution of simple tasks, as well as the 32 KB flash memory capacity. This plate It may be the ideal one for you, if you want to put your programming knowledge into practice.

ARDUINO DUE

ARDUINO DUE

Its controlled mic is AT91SAM3X8E, and It has a 512 KB flash memory excellent for the use of SRAM user applications, This capacity can be amplified because it is integrated with two security banks, one of 64 KB and the other of 32 KB. This Arduino Due board is one of the fastest, since, his watch has a speed of 84 MHz. As for pins, it integrates with 54, of which 12 are PWM output.

ARDUINO Y√öN

ARDUINO Y√öN

Arduino Y√öN It is one of the integrated boards with Micro USB and PoE 802.3af inputs, this being one of the many characteristics that makes it a highly recommended board for any type of programming. Twelve of the fifty-four input and output pins are PWM, and its flash memory is 32 KB, but only 28 KB can be used, since 4 KB is exclusively for the bootloader.

ARDUINO PRO MINI 328, 5V, 16 MHz

 ARDUINO PRO MINI 328, 5V, 16 MHz

Like the Arduino board shown above, it has a board USB connection, adding as a unique feature a tolerance of 0.5% due to its external 16 HMz resonator. The output voltage is maximum five volts. It is recommended for being a plate protected before the dangers of voltage or over current, just as it maintains a shield against polarity reversal.

ARDUINO ETHERNET

ARDUINO ETHERNET

This Arduino board features an ATmga328 micro controller, and a voltage of five volts for its correct operation, its output has 7-12 volts connection, and its input 6-20 volts. Each input or output pin must use 40 mA maximum, and 3.3 50mA pins. Because it is a board that is oriented to Ethernet connections, it integrates with a W 5100 TCP / IP controller, with a 2 KB programmable memory, and 1 KB for the EEPROM.

ARDUINO NANO

ARDUINO NANO

Arduino NANO, contains an ATMega328 micro controller, allowing us to use a memory capacity of 1 KB, although, its flash memory is only 32 KB. Its clock works with a frequency speed of 16 MHz, and its dimensions are 0.73√ó1.70 inches.

ARDUINO FIO

ARDUINO FIO

The technical structure of this Arduino board allows us to comfortably work any programming. Your controller or processor works at a frequency of 8 MHz, and it turns out to be completely compatible with lithium polymer batteries. It is made up of a Reset button in case the board needs to be reset, as well as on and off buttons.

ARDUINO LYLIPAD 328

ARDUINO LYLIPAD 328

To finish with the list of Arduino boards we leave Arduino LYLIPAD 328. Its name contains the digits 328 because the microcontroller is the ATMega328V, which operates correctly with a frequency of 8MHz. In terms of dimensions, this has external diameter 50 mm, and thickness 0.8 mm. It is one of the newest boards, so it integrates an automatic reset when detecting a system collapse.

The best Arduino projects that you can do yourself to learn how to create free hardware

Create a free hardware it is not an impossible task, the first thing is know which one is going to do the same function, and the algorithm for the programming.

If you still do not have in mind what project to do to learn how to create in Arduino, here are some simple and recognized projects:

Simple pushbutton

Simple pushbutton

If you are starting in the electronics area, you can start with this project, it is based on pressing a switch to turn on a led. Of all the projects you can find, this is the simplest and easiest to use. Although a pushbutton may seem useless, it is the beginning of all electronic programming. Learning how to create a pushbutton like this is the base properly start in the Arduino world. You will need a UNO board, six LEDs, and six switches to create a small one-eighth piano.

The codes that you will have to write are:

#include "pitches.h"

const int  buttonPin1  =  13 ;     //C

const int  buttonPin2  =  12 ;   // CS

const int  buttonPin3  =  11 ;   //D

const int  buttonPin4  =  10 ;   // DS

const int  buttonPin5  =  9 ;    // E

const int  buttonPin6  =  8 ;    //F

const int  buttonPin7  =  7 ;    // FS

const int  buttonPin8  =  6 ;    //GRAMO

const int  buttonPin9  =  5 ;    // GS

const int  buttonPin10  =  4 ;   //A

const int  buttonPin11  =  3 ;   //COMO

const int  buttonPin12  =  2 ;   //B

const int  buttonPin13  =  1 ;   //C

const int  dip1  =  A0 ;  // LSB, 1

const int  dip2  =  A1 ; // 2

const int  dip3  =  A2 ; // 3

const int  dip4  =  A3 ; // 4

const int  dip5  =  A4 ; // 5

const int  dip6  =  A5 ;  // MSB, 6

int dip1state  =  0 ;

int dip2state  =  0 ;

int dip3state  =  0 ;

int dip4state  =  0 ;

int dip5state  =  0 ;

int dip6state = 0;

int buttonState1 = 0;

int buttonState2 = 0;

int buttonState3 = 0;

int buttonState4 = 0;

int buttonState5 = 0;

int buttonState6 = 0;

int buttonState7 = 0;

int buttonState8 = 0;

int buttonState9 = 0;

int buttonState10 = 0;

int buttonState11 = 0;

int buttonState12 = 0;

int buttonState13 = 0;

void setup() {

pinMode(buttonPin1, INPUT);

pinMode(buttonPin2, INPUT);

pinMode(buttonPin3, INPUT);

pinMode(buttonPin4, INPUT);

pinMode(buttonPin5, INPUT);

pinMode(buttonPin6, INPUT);

pinMode(buttonPin7, INPUT);

pinMode(buttonPin8, INPUT);

pinMode(buttonPin9, INPUT);

pinMode(buttonPin10, INPUT);

pinMode(buttonPin11, INPUT);

pinMode(buttonPin12, INPUT);

pinMode(buttonPin13, INPUT);

pinMode(dip1, INPUT);

pinMode(dip2, INPUT);

pinMode(dip3, INPUT);

pinMode(dip4, INPUT);

pinMode(dip5, INPUT);

pinMode(dip6, INPUT);

}

void loop(){

// read the state of the pushbutton value:

buttonState1 = digitalRead(buttonPin1);

buttonState2 = digitalRead(buttonPin2);

buttonState3 = digitalRead(buttonPin3);

buttonState4 = digitalRead(buttonPin4);

buttonState5 = digitalRead(buttonPin5);

buttonState6 = digitalRead(buttonPin6);

buttonState7 = digitalRead(buttonPin7);

buttonState8 = digitalRead(buttonPin8);

buttonState9 = digitalRead(buttonPin9);

buttonState10 = digitalRead(buttonPin10);

buttonState11 = digitalRead(buttonPin11);

buttonState12 = digitalRead(buttonPin12);

buttonState13 = digitalRead(buttonPin13);

dip1state = digitalRead(dip1);

dip2state = digitalRead(dip2);

dip3state = digitalRead(dip3);

dip4state = digitalRead(dip4);

dip5state = digitalRead(dip5);

dip6state = digitalRead(dip6);

if (dip1state == LOW //00 or 19 in HEX; C4

&& dip2state == LOW

&& dip3state == LOW

&& dip4state == LOW

&& dip5state == LOW

&& dip6state == LOW

|| dip1state == HIGH

&& dip2state == LOW

&& dip3state == LOW

&& dip4state == HIGH

&& dip5state == HIGH

&& dip6state == LOW )

{ if (buttonState1 == LOW) {

tone(0, NOTE_C4);}

else if (buttonState2 == LOW) {

tone(0, NOTE_CS4);}

else if(buttonState3 == LOW) {

tone(0, NOTE_D4);}

else if(buttonState4 == LOW) {

tone(0, NOTE_DS4);}

else if(buttonState5 == LOW) {

tone(0, NOTE_E4);}

else if(buttonState6 == LOW) {

tone(0, NOTE_F4);}

else if(buttonState7 == LOW) {

tone(0, NOTE_FS4);}

else if(buttonState8 == LOW) {

tone(0, NOTE_G4);}

else if(buttonState9 == LOW) {

tone(0, NOTE_GS4);}

else if(buttonState10 == LOW) {

tone(0, NOTE_A4);}

else if(buttonState11 == LOW) {

tone(0, NOTE_AS4);}

else if(buttonState12 == LOW) {

tone(0, NOTE_B4);}

else if(buttonState13 == LOW) {

tone(0, NOTE_C5);}

else {

noTone(0); }

}

else if (dip1state == HIGH        //01 in HEX; C2

&& dip2state == LOW

&& dip3state == LOW

&& dip4state == LOW

&& dip5state == LOW

&& dip6state == LOW)

{ if (buttonState1 == LOW) {

tone(0, NOTE_C2);}

else if (buttonState2 == LOW) {

tone(0, NOTE_CS2);}

else if(buttonState3 == LOW) {

tone(0, NOTE_D2);}

else if(buttonState4 == LOW) {

tone(0, NOTE_DS2);}

else if(buttonState5 == LOW) {

tone(0, NOTE_E2);}

else if(buttonState6 == LOW) {

tone(0, NOTE_F2);}

else if(buttonState7 == LOW) {

tone(0, NOTE_FS2);}

else if(buttonState8 == LOW) {

tone(0, NOTE_G2);}

else if(buttonState9 == LOW) {

tone(0, NOTE_GS2);}

else if(buttonState10 == LOW) {

tone(0, NOTE_A2);}

else if(buttonState11 == LOW) {

tone(0, NOTE_AS2);}

else if(buttonState12 == LOW) {

tone(0, NOTE_B2);}

else if(buttonState13 == LOW) {

tone(0, NOTE_C3);}

else {

noTone(0); }

}

else if (dip1state == LOW        //02 in HEX; CS2

&& dip2state == HIGH

&& dip3state == LOW

&& dip4state == LOW

&& dip5state == LOW

&& dip6state == LOW)

{if (buttonState1 == LOW) {

tone(0, NOTE_CS2);}

else if (buttonState2 == LOW) {

tone(0, NOTE_D2);}

else if(buttonState3 == LOW) {

tone(0, NOTE_DS2);}

else if(buttonState4 == LOW) {

tone(0, NOTE_E2);}

else if(buttonState5 == LOW) {

tone(0, NOTE_F2);}

else if(buttonState6 == LOW) {

tone(0, NOTE_FS2);}

else if(buttonState7 == LOW) {

tone(0, NOTE_G2);}

else if(buttonState8 == LOW) {

tone(0, NOTE_GS2);}

else if(buttonState9 == LOW) {

tone(0, NOTE_A2);}

else if(buttonState10 == LOW) {

tone(0, NOTE_AS2);}

else if(buttonState11 == LOW) {

tone(0, NOTE_B2);}

else if(buttonState12 == LOW) {

tone(0, NOTE_C3);}

else if(buttonState13 == LOW) {

tone(0, NOTE_CS3);}

else {

noTone(0); }

}

//realiza los mismos pasos hasta llegar al 15 in GS3

else if (dip1state == HIGH       // 15 in HEX; GS3

&& dip2state == LOW

&& dip3state == HIGH

&& dip4state == LOW

&& dip5state == HIGH

&& dip6state == LOW)

{ if (buttonState1 == LOW) {

tone(0, NOTE_GS3);}

else if (buttonState2 == LOW) {

tone(0, NOTE_A3);}

else if(buttonState3 == LOW) {

tone(0, NOTE_AS3);}

else if(buttonState4 == LOW) {

tone(0, NOTE_B3);}

else if(buttonState5 == LOW) {

tone(0, NOTE_C4);}

else if(buttonState6 == LOW) {

tone(0, NOTE_CS4);}

else if(buttonState7 == LOW) {

tone(0, NOTE_D4);}

else if(buttonState8 == LOW) {

tone(0, NOTE_DS4);}

else if(buttonState9 == LOW) {

tone(0, NOTE_E4);}

else if(buttonState10 == LOW) {

tone(0, NOTE_F4);}

else if(buttonState11 == LOW) {

tone(0, NOTE_FS4);}

else if(buttonState12 == LOW) {

tone(0, NOTE_G4);}

else if(buttonState13 == LOW) {

tone(0, NOTE_GS4);}

else {

noTone(0); }

}

else if (dip1state == LOW

&& dip2state == HIGH

&& dip3state == HIGH

&& dip4state == LOW

&& dip5state == HIGH

&& dip6state == LOW)

{ if (buttonState1 == LOW) {

tone(0, NOTE_A3);}

else if (buttonState2 == LOW) {

tone(0, NOTE_AS3);}

else if(buttonState3 == LOW) {

tone(0, NOTE_B3);}

else if(buttonState4 == LOW) {

tone(0, NOTE_C4);}

else if(buttonState5 == LOW) {

tone(0, NOTE_CS4);}

else if(buttonState6 == LOW) {

tone(0, NOTE_D4);}

else if(buttonState7 == LOW) {

tone(0, NOTE_DS4);}

else if(buttonState8 == LOW) {

tone(0, NOTE_E4);}

else if(buttonState9 == LOW) {

tone(0, NOTE_F4);}

else if(buttonState10 == LOW) {

tone(0, NOTE_FS4);}

else if(buttonState11 == LOW) {

tone(0, NOTE_G4);}

else if(buttonState12 == LOW) {

tone(0, NOTE_GS4);}

else if(buttonState13 == LOW) {

tone(0, NOTE_A4);}

else {

noTone(0); }

}

else if (dip1state == HIGH

&& dip2state == HIGH

&& dip3state == HIGH

&& dip4state == LOW

&& dip5state == HIGH

&& dip6state == LOW)

{ if (buttonState1 == LOW) {

tone(0, NOTE_AS3);}

else if (buttonState2 == LOW) {

tone(0, NOTE_B3);}

else if(buttonState3 == LOW) {

tone(0, NOTE_C4);}

else if(buttonState4 == LOW) {

tone(0, NOTE_CS4);}

else if(buttonState5 == LOW) {

tone(0, NOTE_D4);}

else if(buttonState6 == LOW) {

tone(0, NOTE_DS4);}

else if(buttonState7 == LOW) {

tone(0, NOTE_E4);}

else if(buttonState8 == LOW) {

tone(0, NOTE_F4);}

else if(buttonState9 == LOW) {

tone(0, NOTE_FS4);}

else if(buttonState10 == LOW) {

tone(0, NOTE_G4);}

else if(buttonState11 == LOW) {

tone(0, NOTE_GS4);}

else if(buttonState12 == LOW) {

tone(0, NOTE_A4);}

else if(buttonState13 == LOW) {

tone(0, NOTE_AS4);}

else {

noTone(0); }

}

else if (dip1state == LOW

&& dip2state == LOW

&& dip3state == LOW

&& dip4state == HIGH

&& dip5state == HIGH

&& dip6state == LOW)

{ if (buttonState1 == LOW) {

tone(0, NOTE_B3);}

else if (buttonState2 == LOW) {

tone(0, NOTE_C4);}

else if(buttonState3 == LOW) {

tone(0, NOTE_CS4);}

else if(buttonState4 == LOW) {

tone(0, NOTE_D4);}

else if(buttonState5 == LOW) {

tone(0, NOTE_DS4);}

else if(buttonState6 == LOW) {

tone(0, NOTE_E4);}

else if(buttonState7 == LOW) {

tone(0, NOTE_F4);}

else if(buttonState8 == LOW) {

tone(0, NOTE_FS4);}

else if(buttonState9 == LOW) {

tone(0, NOTE_G4);}

else if(buttonState10 == LOW) {

tone(0, NOTE_GS4);}

else if(buttonState11 == LOW) {

tone(0, NOTE_A4);}

Electronic die

Electronic die

If you are fond of board games, this project is for you, since, it is about create an electronic die, with a Arduino UNO board. The die is made up of 7 LEDs, which as the user presses the button, the numbers from 1 to 6 will be displayed at random.

The instructions that you will have to add to the IDE are:

// Definición de pines LED

int ledPins [ 7 ]  =  { 2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 };

int dicePatterns [ 7 ] [ 7 ]  =  {

{ 0 , 0 ,  0 ,  0 ,  0 ,  0 ,  1 },  // 1

{ 0 , 0 ,  1 ,  1 ,  0 ,  0 ,  0 },  // 2

{ 0 , 0 ,  1 ,  1 ,  0 ,  0 ,  1 },  // 3

{ 1 , 0 ,  1 ,  1 ,  0 ,  1 ,  0 },  // 4

{ 1 , 0 ,  1 ,  1 ,  0 ,  1 ,  1 },  // 5

{ 1 , 1 ,  1 ,  1 ,  1 ,  1 ,  0 },  // 6

{ 0 , 0 ,  0 ,  0 ,  0 ,  0 ,  0 }  // En blanco

};

int switchPin  =  9 ;    // Definición de pin de botón

int blanco  =  6 ;

configuración vacía ()

{

para ( int  i  =  0 ;  i  <  7 ;  i ++ )

{

pinMode ( ledPins [ i ], SALIDA );

digitalWrite ( ledPins [ i ], BAJO );

}

randomSeed(analogRead(0));

}

void loop()

{

if (digitalRead(switchPin))

{

rollTheDice();

}

delay(100);

}

void rollTheDice()

{

int result = 0;

int lengthOfRoll = random(15, 25);

for (int i = 0; i < lengthOfRoll; i++)

{

result = random(0, 6);

show(result);

delay(50 + i * 10);

}

for (int j = 0; j < 3; j++)

{

show(blank);

delay(500);

show(result);

delay(500);

}

}

void show(int result)

{

para ( int  i  =  0 ;  i  <  7 ;  i ++ )

{

digitalWrite ( ledPins [ i ], dicePatterns [ resultado ] [ i ]);

}

}

Light tracker

Light tracker

This project is based in a simple light tracker / tracker, It is made up of two photoresistors (a component that is sensitive to light) that plays a fundamental role in the project. If it detects the light, it will move by means of a servo.

For it to work you will have to program the Nano R3 board with the following instructions:

#include <Servo.h>

Servo myServoEW ;

Servo myServoNS ;

int farkNS ;

int farkEW ;

int degNS ;

int degEW ;

int ldrN ;

int ldrW ;

int ldrS ;

int ldrE ;

configuración vacía () {

// Escribe a continuación tu código de configuración

begin ( 115200 ) ;

attach ( 5 ) ;

attach ( 4 ) ;

retraso ( 500 ) ;

degNS=90;

degEW=90;

write(degNS);

write(degEW);

}

void loop() {

ldrN=analogRead(A0);

ldrW=analogRead(A1);

ldrS=analogRead(A2);

ldrE=analogRead(A3);

print("ldrN:");

print(ldrN);

print(" ldrW:");

print(ldrW);

print(" ldrS:");

print(ldrS);

print(" ldrE:");

print(ldrE);

print(" degEW");

print(degEW);

print(" degNS");

println(degNS);

delay(100);

if (ldrN>ldrS)

{

farkNS=ldrN-ldrS;

if (farkNS>5)

{

degNS++;

write(degNS);

}

}

if (ldrS>ldrN)

{

farkNS=ldrS-ldrN;

if (farkNS>5)

{

degNS--;

write(degNS);

}

}

if (ldrW>ldrE)

{

farkEW=ldrW-ldrE;

if (farkEW>5)

{

degEW++;

write(degEW);

}

}

if ( ldrE> ldrW )

{

farkEW = ldrE-ldrW ;

si ( farkEW> 5 )

{

degEW-- ;

write ( degEW ) ;

}

}

}

Check the ambient light

Check the ambient light

If you want to know the level of sound and light that is in place you will be able to choose Arduino. This type of project is the one indicated to know if the noise and lighting are optimal for the established parameters. The green led turns on, and as they decrease, the yellow and red led will turn on..

Configure your Arduino UNO with the following codes:

const int ledCount = 12; // numero de leds

int sensorReading; // lectura del ADC 0-1024

int ledPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};

void setup() {

begin(9600); //inicamos el puerto Serial

for (int thisLed = 0; thisLed < ledCount; thisLed++) {pinMode(ledPins[thisLed], OUTPUT);}

}

void loop() {

sensorReading = analogRead(A1);

println(sensorReading);

int ledLevel = map(sensorReading, 200,500, 0, ledCount);

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

if (thisLed < ledLevel) {

digitalWrite(ledPins[thisLed], HIGH);// encendemos los LED segun la intensidad de la se√Īal

}

else {

digitalWrite(ledPins[thisLed], LOW);// apagamos los LED segun la intensidad de la se√Īal

}

}

delay(10);

}

Halloween Project

Halloween Project

A skull to have fun on Halloween very simple and entertaining, The components to be used are: 1 servomotor inside the box, 1 infrared sensor, the latter is responsible for detecting if there is an object in the box, if so, the box will be closed with the help of the servomotor.

To carry out this project you will need to add the following commands in the Arduino IDE:

importar transmisiones

de floyd.rtttl  importar  rtttl

importar subprocesos

# importar módulo toishield

de toishield  importar  toishield

# importar módulo neopixel

de neopixel  importar  ledstrips  como  neo

arroyos . serial ()

# establecer detección habilitada y calabaza inactiva de forma predeterminada

toishield . micrófono . detecciónEnabled =  Verdadero

toishield . micrófono . activePumpkin =  Falso

# establecer alguna variable para la detección de sonido

toishield . micrófono . staticMin =  4096

toishield . micrófono . staticMax =  - 4096

toishield . micrófono . resetMinMaxCounter =  0

# ¬°Declare que los leds parpadeen!

leds =  neo . ledstrip ( toishield . led_pin ,  16 )

setall(0,0,0)

on()

# semaphore initialized to 0 -> red: if a thread tries to acquire the semaphore

# it blocks if the semaphore has not been turned 'green' (released)

semaphore = threading.Semaphore(0)

# define a RTTTL Halloween melody to be played by passing it the RTTTL string.

hsong = rtttl.tune('Halloween:d=4,o=5,b=180:8d6,8g,8g,8d6,8g,8g,8d6,8g,8d#6,8g,8d6,8g,8g,8d6,8g,8g,8d6,8g,8d#6,8g,8c#6,8f#,8f#,8c#6,8f#,8f#,8c#6,8f#,8d6,8f#,8c#6,8f#,8f#,8c#6,8f#,8f#,8c#6,8f#,8d6,8f#')

# toishield.buzzer_pin=D9.PWM

def blink():

# blink while the pumpkin is active

while toishield.microphone.activePumpkin:

setall(255,0,0)

on()

sleep(500)

setall(255,140,0)

on()

sleep(500)

setall(0,0,0)

on()

release()

def playHalloween():

# plays halloween song two times, then disables pumpkin, but also waits

# at the semaphore to synchronize with blinking thread

for i in range(2):

play(toishield.buzzer_pin)

microphone.activePumpkin = False

acquire()

sleep(1000)

print("enabled again")

microphone.detectionEnabled = True

def scare():

# this is called when the sound exceeds the threshold, waits one second

# and starts scaring!

sleep(1000)

thread(playHalloween)

thread(blink)

# define a function that takes a sensor object as parameter and checks the

# maximum peak to peak extension of the signal in a preset window

# look at this

# example for details on how the sound detector works

def detectSound(obj):

if (obj.resetMinMaxCounter == obj._observationWindowN):

extension = obj.staticMax - obj.staticMin

if (extension > 1000):

if obj.detectionEnabled:

detectionEnabled = False

activePumpkin = True

thread(scare)

staticMax, obj.staticMin = -4096, 4096

resetMinMaxCounter = 0

else:

c = obj.currentSample()

if (c > obj.staticMax):

staticMax = c

elif (c < obj.staticMin):

staticMin = c

resetMinMaxCounter += 1

# establecer 'detectSound' como la función que se aplicará al objeto en cada paso de muestreo

toishield . micrófono . doEverySample ( detectar sonido )

toishield . micrófono . startSampling ( 1 , 50 , "raw" )

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thanks! ūüėČ

Mario Jose

Author: Mario José

Graduated in journalism, specialized in investigation, I seek the truth of all things. Now 100% focused on technology, computing and the Internet.

You may be interested:

Leave a Comment