Pages: [1]   Go Down
Author Topic: IDE unable to compile the code :smiley-surprise:  (Read 5808 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey there! i have written a program C with code::block 12.11 .... and the problem is arduino IDE is unable to compile the code! please check this code out! HELP  smiley  smiley  smiley
Code:
#include<stdio.h>
#include<time.h>
#include<stdlib.h>


     const int DELAY_TIME = 1;
     const int RUNNING_TIME = 30;
int main() {

     long long int start = time(NULL);
     long long int MWANZO = time(NULL);
     int timer = DELAY_TIME;

     while((time(NULL)-MWANZO)<RUNNING_TIME){
     int K, L;
     for(K=1; K<=8; K++){
         do {
            if(timer == DELAY_TIME) {
                timer = 0;
                start = time (NULL);
                system ("cls");
                for(L=1; L<=8; L++){
                    if(L==K) printf("\t0");
                    else printf("\t.");
                    }
                    printf("\n\n");
            } else{
            timer = time(NULL) - start;
            }
         } while(timer != DELAY_TIME);
     }


     }

}

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8646
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is a C program with a main() function.  To make it into an Arduino sketch you should start by changing  "int main()" to "void setup()" and adding "void loop() {}" at the bottom.

Then you will have to deal with the functions time() and system() being undefined.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: