Chipkit Max32 and Multifunction shield example

I recently purchased a Chipkit Max32 and was pleased to see that this board has protection so that it can interface with 5v board, shields and modules.

This is a snag with many ‘arduino’ compatible boards, they are 3.3v I/O but a lot feature 5v to the shield and then analog/digital inputs and outputs from the shield will run at 5v hence damaging the main board.

In this firs part we will look at various arduino shields and make sure the shield works and will have a few examples

In this one we look at the Multifunction shield

&nbsp

Features

4 -way LED indicator
DS18B20 temperature sensor interface that can be done to measure the temperature of the experiment – not included
LM35 temperature sensor interface that can be done to measure the temperature of the experiment – not included
3296 precision adjustable potentiometer, analog input port
integrated infrared receiver that can fit any infrared remote control experiments
four digital tube ( using 74HC595 driver provincial IO learning SPI), you can do digital display experiment
three separate buttons, a reset button
the buzzer sound can be used for experiments .
infrared detector

 

Code Examples

Blink LED example

Blinking LED
 
int led = 13;
 
void setup() 
{                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}
 
 
void loop() 
{
  digitalWrite(led, HIGH);   
  delay(1000);              
  digitalWrite(led, LOW);   
  delay(1000);               
}

Flashing LEDs example

int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
 
void setup() 
{                
  // initialize the digital pin as an output.
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT); 
  pinMode(led3, OUTPUT); 
  pinMode(led4, OUTPUT); 
}
 
 
void loop() 
{
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(led4, HIGH);
  delay(1000);              
  digitalWrite(led1, LOW);   
  digitalWrite(led2, LOW); 
  digitalWrite(led3, LOW);  
  digitalWrite(led4, LOW); 
  delay(1000);               
}

Buttons example

const byte LED[] = {13,12,11,10};
 
#define BUTTON1 A1
#define BUTTON2 A2
 
void setup() 
{                
  // initialize the digital pin as an output.
  /* Set each pin to outputs */
  pinMode(LED[0], OUTPUT);
  pinMode(LED[1], OUTPUT);
  pinMode(LED[2], OUTPUT);
  pinMode(LED[3], OUTPUT);
}
 
 
void loop() 
{
  if(!digitalRead(BUTTON1))
  {
    digitalWrite(LED[0], HIGH);
    digitalWrite(LED[1], HIGH);
    digitalWrite(LED[2], HIGH);
    digitalWrite(LED[3], HIGH);  
  }  
 
  if(!digitalRead(BUTTON2))
  {
    digitalWrite(LED[0], LOW);
    digitalWrite(LED[1], LOW);
    digitalWrite(LED[2], LOW);
    digitalWrite(LED[3], LOW); 
  }      
}

POT example

#define Pot1 0
 
void setup()
{
  Serial.begin(9600); 
}
 
/* Main Program */
void loop()
{
 
  Serial.print("Potentiometer reading: ");
  Serial.println(analogRead(Pot1));
  /* Wait 0.5 seconds before reading again */
  delay(500);
}

 

Link

Multi Function Shield with Buzzer LM35 4 Digit Digital LED Expansion Board Voice Module for Arduino UNO R3 Lenardo Mega2560

Share