ProtoSnap Pro Mini on Sparkfun

CAM00221 A new project I am working on is from sparkfun.com called Protosnap pro mini.First, I would like to say I do not like program but I am doing this project with open mind and love to adventure new ideas. I will be programming Protosnap pro mini to light in different color,make noise or break components apart to use for something else.  As of today I am entering into open source software of arduino programing. What is arduino? It’s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. In other word, arduino is programming language that is written in java and similar to c++, however this program was created for certain type of hardware like Protosnap pro mini. Arduino was design to teach basic programming. Programmer experiment with arduino to do various commands to control switches, sensors and various other lights or motors.

The image below show Protosnap pro mini.

CAM00226 CAM00224

Breakdown of what in shown in the 2 images

the FTDI board is the section where you plug into computer it has standard mini B to usb cable

button that is connected to pin 7 as well as UCC(power source) and GND(ground)

Light sensors that connected to GND(ground), A0 (analog pins), and UCC(power)

RGB LED connected various pins, pin 5= G(green),pin 6=B(blue), pin 3=R(red) lately UCC

they call this pin the pin to annoy your roommate the buzzer =pin 2 and GND

Last but not least the proto boardsection the circles next to buzzor, allow you to solder additional sensors or anything else onto the protosnap pro mini

If you turn over the device you can trace where everything connected and see how communication works between various senors and outputs to the mircrocontroller. The program is delivered pre programmed if you press a button it will make noise or if you cover your finger over light sensor, the RED LED display various colors.

Here the start of program process in arduino. I use sample from the website to guide me through the progress of program the Protosnap pro mini. The following was coded to activate button when it is press. int buttonPin = 7 which mean button is connected to pin 7. The program input and output is through electronically, if it reads high (5V), then that means the button is not being pressed. While a low (0V) indicates that the button is being pressed. The program is coded in conditions of if or else statement to activate the Protosnap pro mini to make sound on low voltage which mean button is being press and when no button being press it is high voltage and LED is off.

int buttonPin = 7; // button is connected to pin 7
int ledPin = 13; // LED’s connected to pin 13
int buttonStatus; // variable we’ll use to store the button’s status

void setup() {
pinMode(buttonPin, INPUT); // Initialize the buttonPin as input
pinMode(ledPin, OUTPUT); // The LED is an output
}

void loop() {
/* First read the status of the button
HIGH = button is NOT pressed
LOW = button IS pressed */
buttonStatus = digitalRead(buttonPin);

if (buttonStatus == LOW) {
digitalWrite(ledPin, HIGH); // If the button’s pressed turn the LED on
}
else {
digitalWrite(ledPin, LOW); // Otherwise, turn the LED off
}
}

int button = 7;
int buzzer = 2;
int light = A0;
int red = 3;
int blue = 6;
int green = 5;


void setup() 
{    
Serial.begin(9600);
  
pinMode(buzzer, OUTPUT);  
pinMode(red, OUTPUT);  
pinMode(green, OUTPUT);  
pinMode(blue, OUTPUT);

pinMode(button, INPUT);
 Serial.println("I am a protosnap, waiting to hear space bar:");
}

void loop() 
{
 
  if(Serial.available() > 0)
    {
    if(Serial.read() == 32)
    Serial.println("I HEARD THAT, OH SNAP!");
    }
    
while(digitalRead(button) == LOW)
{
digitalWrite(buzzer, HIGH);
delayMicroseconds(400);
digitalWrite(buzzer, LOW);
delayMicroseconds(50);
}


int temp = analogRead(light);
if(temp > 100)
{
  digitalWrite(red, HIGH);
  digitalWrite(green, HIGH);
  digitalWrite(blue, HIGH);
}
else 
{
  digitalWrite(red, LOW);
  digitalWrite(green, HIGH);
  digitalWrite(blue, HIGH);
  delay(500);
    digitalWrite(red, HIGH);
  digitalWrite(green, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
    digitalWrite(red, HIGH);
  digitalWrite(green, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
}
}

My program that I have put together

int variableColor;                                         // declare the light pins
void setup(){
pinMode(7,INPUT);                                      //declare button connected to pin 7
digitalWrite(7,HIGH);                                    //setting internal pull up resistor to off when set to HIGH 0 voltage
pinMode(3,OUTPUT);                                   //declare the RGB LED pins
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}
void loop() {
variableColor= analogRead (A0);                     //read light sensor

//when button is press provided a path to GND(ground) setting voltage to low to display color of choice declared

digitalWrite(6,LOW);                              //signal the buzzer to display color blue when turn on
digitalWrite(3,HIGH);                             //signal the controller to turn off red when buzzer press
digitalWrite(5,HIGH);                             //signal the controller to turn off green when buzzer press
tone (2,1100,1000);        //control sound of buzzer, allow the buzzor to be active when press for 1 second (duration)
delay (1000);                                        //after 1 second sound from buzzer stops
}

Advertisements

One comment

  1. D · October 7, 2014

    Good. You could make the onboard LED blink with the code you listed. What if you wanted to make some of the other components on the ProtoSnap respond to an input. How might you achieve it given the sample code posted on the blog?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s