arduino uno stopwatch

I have a sketch found for max7219 8 digits display, to make a stop watch.
but that was created with a chipkit uno32. and used I/O port 38 for press Stud.
My question is that port 38 interchangeable with arduino uno A0???

/*
 #######################################################
 Project: chipKIT Uno32 Stopwatch
 Description: This project describes how to interface a MAX7219 based serial seven segment
              LED display to contruct a simple digital stopwatch. A push button is connected to 
              INT0 pin of chipKIT Uno32 board for start and stop operation
 Written by: Raj Bhatt (May 2, 2014)
 www.embedded-lab.com
 #######################################################
 
MAX7219 connections:
 -------------------------------------
 MAX7219                       chipKIT Uno32
 VCC      --------------->     5.0V
 DIN      --------------->     Pin 7
 CLK      --------------->     Pin 6
 LOAD     --------------->     Pin 5
 GND      --------------->     GND
 #######################################################
 
 Start/Stop tact switch is connected to INT0 (Pin 38) pin.
 
 This software is licensed under a 
 Creative Commons Attribution-ShareAlike 3.0. 
 */

#include "LedControl.h"

// Pin 7 to Data In, 6 to Clk, 5 to LOAD
LedControl lc=LedControl(7,6,5,1);

int fsec, sec, minute, i, Start;
long previousMillis = 0;
long interval = 100;

void setup()
{
  // the zero refers to the MAX7219 number, it is zero for 1 chip
  lc.shutdown(0,false);// turn off power saving, enables display
  lc.setIntensity(0,15);// sets brightness (0~15 possible values)
  lc.clearDisplay(0);// clear screen
  fsec = 0;
  sec = 0;
  minute = 0;
  Start = 0;
  lc.setChar(0, 2,'-',false);
  lc.setChar(0, 5,'-',false);
  Disp_Data();
  attachInterrupt(0, Button_Pressed, FALLING);
}
void loop()
{
  if(Start == 1) {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      // save the last time you blinked the LED 
      previousMillis = currentMillis; 
      fsec = fsec+10;
      if(fsec == 100) {
        fsec = 0;
        sec = sec+1;
        if (sec == 60) {
         sec = 0;
         minute = minute+1;
         if(minute == 100) minute = 0; 
        }
      }
      Disp_Data(); 
    }  
  }
}

void Button_Pressed(){
if (Start == 1) {
  Start = 0;
 }
else if (Start == 0){
   Start = 1;
 }
}

void Disp_Data(){
  int ones, tens;
  // First display fsec
  ones = fsec%10;
  tens = (fsec/10)%10;
  lc.setDigit(0,1,(byte)tens,false);
  lc.setDigit(0,0,(byte)ones,false);
    
  // Now display sec
  ones = sec%10;
  tens = (sec/10)%10;
  lc.setDigit(0,4,(byte)tens,false);
  lc.setDigit(0,3,(byte)ones,false);
  
  // Next display mm
  ones = minute%10;
  tens = (minute/10)%10;
  lc.setDigit(0,7,(byte)tens,false);
  lc.setDigit(0,6,(byte)ones,false);
    
 }

I can with the uno compilleren this program, so it would have to work further.
But is port 38 te same als A0 on uno

not familiar with the chipkit uno32 but have done some work on stopwatches.

have a look at - Arduino Playground - StopWatchClass -

do you have a datasheet of the chipkit?

i have done little search and came up with the following image, and another file wich i am almost certian of to be correct, however i cannot open it as i dont have MS excel installed now. please see attachment.

image; https://s3.amazonaws.com/img.docstoc.com/thumb/orig/101628274.png

and below attachment with pinouts in excel doc

hope that helps, also view; http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-UNO32

nick

chipKIT Uno32 Pinout Table.zip (11.8 KB)

chipkit uno

or is pin 38 of chipkit uno32 is compatible with arduino uno i/o pin D12?

there are 2 connectors side by side.

I assume :

  • pin 12 is the same as the Arduino pin 12
  • pin 38 is the pin next to pin 12 on the inside

same on the other side

  • pin A0 is on the outside connector
  • pin A6 is on the inside

the 2 with the yellow box (A4+A5) is I2C

Hi
It works now :wink:

Ledcotrol changed 12,11,10,1
en D2 changed for pin 38

Good to hear!

Can you please post the final code for future references?

what is changed

/*
 #######################################################
 Project: chipKIT Uno32 Stopwatch
 Description: This project describes how to interface a MAX7219 based serial seven segment
              LED display to contruct a simple digital stopwatch. A push button is connected to 
              INT0 pin of chipKIT Uno32 board for start and stop operation
 Written by: Raj Bhatt (May 2, 2014)
 www.embedded-lab.com
 #######################################################
 
MAX7219 connections:
 -------------------------------------
 MAX7219                       chipKIT Uno32
 VCC      --------------->     5.0V
 DIN      --------------->     Pin 12
 CLK      --------------->     Pin 11
 LOAD     --------------->     Pin 10
 GND      --------------->     GND
 drukknop op D2 met plus op 3.3 volt
 #######################################################
 
 Start/Stop tact switch is connected to INT0 (Pin D2) pin.
 
 This software is licensed under a 
 Creative Commons Attribution-ShareAlike 3.0. 
 */

#include "LedControl.h"

// Pin 7 to Data In, 6 to Clk, 5 to LOAD
LedControl lc=LedControl(12,11,10,1);

int fsec, sec, minute, i, Start;
unsigned long previousMillis = 0;
unsigned long interval = 100;

void setup()
{
  // the zero refers to the MAX7219 number, it is zero for 1 chip
  lc.shutdown(0,false);// turn off power saving, enables display
  lc.setIntensity(0,15);// sets brightness (0~15 possible values)
  lc.clearDisplay(0);// clear screen
  fsec = 0;
  sec = 0;
  minute = 0;
  Start = 0;
  lc.setChar(0, 2,'-',false);
  lc.setChar(0, 5,'-',false);
  Disp_Data();
  attachInterrupt(0, Button_Pressed, FALLING);
}
void loop()
{
  if(Start == 1) {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      // save the last time you blinked the LED 
      previousMillis = currentMillis; 
      fsec = fsec+10;
      if(fsec == 100) {
        fsec = 0;
        sec = sec+1;
        if (sec == 60) {
         sec = 0;
         minute = minute+1;
         if(minute == 100) minute = 0; 
        }
      }
      Disp_Data(); 
    }  
  }
}

void Button_Pressed(){
if (Start == 1) {
  Start = 0;
 }
else if (Start == 0){
   Start = 1;
 }
}

void Disp_Data(){
  int ones, tens;
  // First display fsec
  ones = fsec%10;
  tens = (fsec/10)%10;
  lc.setDigit(0,1,(byte)tens,false);
  lc.setDigit(0,0,(byte)ones,false);
    
  // Now display sec
  ones = sec%10;
  tens = (sec/10)%10;
  lc.setDigit(0,4,(byte)tens,false);
  lc.setDigit(0,3,(byte)ones,false);
  
  // Next display mm
  ones = minute%10;
  tens = (minute/10)%10;
  lc.setDigit(0,7,(byte)tens,false);
  lc.setDigit(0,6,(byte)ones,false);
    
 }

push button for stopwatch

pin 38 must be D2