Go Down

Topic: Intel Galileo Digital Read Problem (Read 66 times) previous topic - next topic

RedDragons23

Mar 18, 2015, 09:56 pm Last Edit: Mar 18, 2015, 10:54 pm by RedDragons23
Hi,
I have the Intel Galileo gen 1 board and most of the digital pins does not seem to function correctly when I used the command digitalRead(). The ones that do work are Pins: 13,12,11,3,2,1. However, I have tried using digitalWrite() on all of the digital pins using a blink program and they all seem to function. The problem that I am having is that even when the pull up resistor is enabled pins 10,9,8,7,6,5,4 all seem to read HIGH when I use digitalRead() when I touch them to GND using a cable or switch, I can't seem to get them to read LOW.

I did do some research before asking, but I haven't come across anyone with the same problem. Is this a hardware limitation/problem? or have I damaged the board? etc.

This board was supplied by the MS IOT program and I do not know which forum to ask Arduino based questions so I thought this was the best place. The code is below (Note: Not all of the code is standard Arduino code):

// Main.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "arduino.h"

int _tmain(int argc, _TCHAR* argv[])
{
   return RunArduinoSketch();
}

const int Power_Pin = 13; // This is the pin the PTM Power Button is attched to.
const int WPump1_Pin = 12; //This is the pin the Water Pump 1 is attached to.
const int WPump2_Pin = 11; //This is the pin the Water Pump 2 is attched to.
const int PumpSwitch1_Pin = 10; // This is the pin the Water Pump Switch is attached to.
const int PumpSwitch2_Pin = 9; // This is the pin the Water Pump Switch is attached to.
int RotarySwitch1[4]; // This is the array to store the pins the Rotary Switch 1 is connected to.
int RotarySwitch2[4]; // This is the array to store the pins the Rotary Switch 1 is connected to.
const int Potentiometer_Pin = A0; // This is the pin the Potentiometer is connected to.
const int Reed_Pin = A1; // This is the pin the Reed Switch is connected to.
const int Probe_Pin = A2; // This is the pin the Soil Moisture Sensor is connected to.

void setup()
{
//Set Rotary Switch 1 Pin Numbers
RotarySwitch1[1] = 8;
RotarySwitch1[2] = 7;
RotarySwitch1[3] = 6;
RotarySwitch1[4] = 5;

//Set Rotary Switch 2 Pin Numbers
RotarySwitch2[1] = 4;
RotarySwitch2[2] = 3;
RotarySwitch2[3] = 2;
RotarySwitch2[4] = 1;

//Setting the PinModes (INPUTS)
pinMode(Power_Pin,INPUT_PULLUP);
pinMode(PumpSwitch1_Pin, INPUT_PULLUP);
pinMode(PumpSwitch2_Pin, INPUT_PULLUP);

//Setting the Rotary Switches PinModes (INPUTS)
int X = 0;
for (X = 1; X < 5; X++){
pinMode(RotarySwitch1[X], INPUT_PULLUP);
pinMode(RotarySwitch2[X], INPUT_PULLUP);
}
 
//Setting the PinModes (OUTPUTS)
pinMode(WPump1_Pin, OUTPUT);
pinMode(WPump2_Pin, OUTPUT);

digitalWrite(WPump1_Pin, LOW);
digitalWrite(WPump2_Pin, LOW);
}

// the loop routine runs over and over again forever:
void loop()
{
int tempVal = 0;
tempVal = digitalRead(Power_Pin);
Log("Value %i \r\n", tempVal);
delay(100);

tempVal = digitalRead(PumpSwitch1_Pin);
Log("Value %i \r\n", tempVal);
delay(100);

tempVal = digitalRead(PumpSwitch2_Pin);
Log("Value %i \r\n", tempVal);
delay(100);

int Y = 0;
for (Y = 1; Y < 5; Y++){
tempVal = digitalRead(RotarySwitch1[Y]);
Log("Value %i \r\n", tempVal);

tempVal = digitalRead(RotarySwitch2[Y]);
Log("Value %i \r\n", tempVal);
delay(100);
}

Log("*** END *** \r\n");

delay(200);

}


RedDragons23

Go Up