Hi, Basically i have built an electronic project, it is a set of trafic lights using a Darlington Driver and a D25 connector, i built that no problems and it works, i know this because in college my programming lecturer helped my right a program in C to control these lights and sequence them.
Ok they worked fine at college and i was quite happy.
BUT......
When i got home i thought i would try and re create the scene, by writing the program in Turbo C. so i wrote the program, of which the code i shall show in a moment, but i noticed when i pluged the D25 into the back of the computer, all the lights stayed on, they did not do this at college, i tried it on another of my computers, and the same. how can i get them to turn off?
My code:
#include <stdio.h>
#include <dos.h>
#include <conio.h>
void main(void){
int Led[4]={33,19,12,26};
int i=0;
int Time;
while(!kbhit()){
outportb(0x378,Led[i]);
switch (Led[i]){
case 33: Time = 2000;
break;
case 19: Time = 500;
break;
case 12: Time = 1500;
break;
case 26: Time = 500;
break;
}
Delay(Time);
i++;
if (i>2);
i=0;;
}
}
outportb(0x378,0);
With this code i get a number of Declaration Sytax errors, and "i is assigned a value that is never used in function main"
This is not my code, it was mostly written by my programming lecturer, so i do not understand it all, i understand most of it and the idea of it, as i am still learning C.
If anyone could help me out id appreciate it, i cant imagine that there is anything wrong with the code because it was working in college, unless i have written it down wrong. But i think that the main problem is all the leds staying on, im sure the errors are easily fixable.
Any help would be appreciated.
Thanx
Jon