!(http://I wrote a code to work a sensor array using arduino pins. I just want to get the array values to a serial monitor.But it didnt give expected array values. Here I attached the code and the schematic view of proteus which shows serial monitor values.)
int Inset1={46,47,48,49,50,51,52,53};
int Inset2={7,6,5,4,3,2,14,15};
int dataSet={25,24,23,22};
int i;
int sensoeLevel;
void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
pinMode ( Inset1[8] , INPUT);
pinMode ( Inset2[8] , INPUT);
pinMode ( dataSet[4], OUTPUT);
Inset1[0] = digitalRead(46);
digitalWrite ( dataSet[0],HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
DipSwitch1IncRead ();
DipSwitch2IncRead ();
DipSwitch1DecRead ();
DipSwitch2DecRead ();
}
void DipSwitch1IncRead () {
if (digitalRead (46)==HIGH && digitalRead (7)==LOW){
for (i=0; i<8; i++){
if (digitalRead (Inset1*)==HIGH){*
- Serial.print (“Inset1={”);*
- for ( i=0; i<8; i++){*
_ Serial.print (Inset1*);_
_ }_
_ Serial.print ("}");_
_ Serial.println ("");_
_ digitalRead (Inset1[i+1])==HIGH;_
_ }_
_ } _
_}_
_}_
void DipSwitch2IncRead(){
if (digitalRead (7)==HIGH){
_ for (i=0; i<8; i++){_
_ if (digitalRead (Inset2)==HIGH){
Serial.print (“Inset2={”);
for ( i=0; i<8; i++){
Serial.print (Inset2);
}
Serial.print ("}");
Serial.println ("");
digitalRead (Inset2[i+1])==HIGH;
}
}
}
}
void DipSwitch2DecRead (){
if (digitalRead (15)==HIGH ){
for (i=7; i>=0; i–){
if (digitalRead (Inset2)==LOW){
Serial.print (“Inset2={”);
for (i=7; i>=0; i–){
Serial.print (Inset2);
}
Serial.print ("}");
Serial.println ("");
digitalRead(Inset2[i-1])==LOW;
}
}
}
}
void DipSwitch1DecRead (){
if (digitalRead (53)== HIGH && digitalRead (7)==LOW ){
for (i=7; i>=0; i–){
if (digitalRead (Inset1)==LOW){
Serial.print (“Inset1={”);
for (i=7; i>=0; i–){
Serial.print (Inset1);
}
Serial.print("}");
Serial.println ("");
digitalRead (Inset1[i-1])==LOW;
}
}
}*_
}