User Tools

Site Tools


iso_kard_sketches

Important: The circuitry on the Iso Kard causes the pin to read high when no input is applied and low when there is input.

Here is a sample sketch for that will read the inputs of a ISO Kard. This sketch should run in any version of MPIDE that lists the Quick240 in the boards menu.

Quick240 ISO Kard Read.pde
// KardCxPx is a multi-dimensional array where the first
// index points the Kard slot and the second point to the
// GPIO pin on the Kard, the first four GPIO pins generaly
// connect to the rail pin Px.
uint8_t KardCxPx[7][6] = {
                    { 68, 58, 62, 55, 82, 32 }, // Kard 0
                    { 57, 56, 63, 54, 83, 31 }, // Kard 1
                    { 86, 64,  5, 70, 84, 30 }, // Kard 2
                    { 22, 76,  9,  2, 35, 52 }, // Kard 3
                    { 23, 39,  8, 21, 34, 29 }, // Kard 4
                    { 78, 79, 10, 20, 33, 85 }, // Kard 5
                    { 71, 71, 71, 71, 71, 71 }, // Kard Com //has only on dedicated IO pin
                   };
 
void setup() {
  // Set the digital pins as an output.
  pinMode(KardCxPx[0][0], INPUT);     
  pinMode(KardCxPx[0][1], INPUT);     
  pinMode(KardCxPx[0][2], INPUT);     
  pinMode(KardCxPx[0][3], INPUT);     
  //start the usb serial port to display values read
  Serial.begin(115200);
}
 
void loop() {
  char value_read;
  value_read = digitalRead(KardCxPx[0][0]); //read pin value
  Serial.print(value_read,DEC);             //print the value
  value_read = digitalRead(KardCxPx[0][1]); //read pin value
  Serial.print(value_read,DEC);             //print the value
  value_read = digitalRead(KardCxPx[0][2]); //read pin value
  Serial.print(value_read,DEC);             //print the value
  value_read = digitalRead(KardCxPx[0][3]); //read pin value
  Serial.println(value_read,DEC);           //print the value
                                            //with new line
  delay(1000);                              // wait for a second
}
iso_kard_sketches.txt · Last modified: 2019/08/17 15:04 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki