[help,urgently] arduio programing problem

Hi everyone , i am new here , and i am new in arduino world .

I need to program a code in arduino , but i dont have any idea how , this is what to do ?

I have a Motor with pin10 ,and 1 keyboard , and 4LED with pin (1,2,3,4) , and 4 Switch with pin (5,6,7,8) .PIN 5 will start the system , PIN 6 will stop the system ,PIN7 will rush system ,and PIN8 will slows system .

Please help me to finish this JOB , THANK YOU

How to use this forum

I dont tread rules of this forum , i told i am new in arduino , and i need this coode to countinue .

THANK YOU

Possibly useful start …

#define ASIZEOF(ARRAY)          (sizeof(ARRAY) / sizeof(ARRAY[0]))

const uint8_t   pinMOTOR        = 10;
const uint8_t   pinLED_1        =  1;       // WARNING INTERFERS WITH SERIAL I/O
const uint8_t   pinLED_2        =  2;
const uint8_t   pinLED_3        =  3;
const uint8_t   pinLED_4        =  4;
const uint8_t   pinSWITCH_START =  5;
const uint8_t   pinSWITCH_STOP  =  6;
const uint8_t   pinSWITCH_FAST  =  7;
const uint8_t   pinSWITCH_SLOW  =  8;


// ... THE KEYBOARD CONNECTS TO THE SYSTEM HOW ???? ...


// SWAP THE FOLLOWING IF NEEDED (DEPENDS UPON CIRCUIT WIRING)

const uint8_t   SWITCH_UP       = LOW;
const uint8_t   SWITCH_DOWN     = HIGH;


// SWAP THE FOLLOWING IF NEEDED (DEPENDS UPON CIRCUIT WIRING)

const uint8_t   LED_OFF         = LOW;
const uint8_t   LED_ON          = HIGH;

const uint8_t   pinsSwitches[]  = { pinSWITCH_START, pinSWITCH_STOP, pinSWITCH_FAST, pinSWITCH_SLOW };
const uint8_t   pinsLED[]       = { pinLED_1, pinLED_2, pinLED_3 pinLED_4 };

void loop()
{
    // YOU MAY HAVE TO DEBOUNCE BUTTONS ...
    
    uint8_t     stateSwitch_start   = digitalRead(pinSWITCH_START);
    uint8_t     stateSwitch_stop    = digitalRead(pinSWITCH_STOP);
    uint8_t     stateSwitch_fast    = digitalRead(pinSWITCH_FAST);
    uint8_t     stateSwitch_slow    = digitalRead(pinSWITCH_SLOW);
    
    // ... PROVIDE LOGIC READ BUTTON STATE ...
    // ... READING AND RESPONDING TO THE KEYBOARD WITH A CURRENTLY UNDEFINED IO METHOD ...
    // ... TO SET MOTOR SPEED ...
    // ... AND STATE OF THE LEDS ...
    
    ...
}

void setup()
{
    for ( int i = ASIZEOF(pinsLED); i--; )
    {
        pinMode(pinsLED[i], OUTPUT);

        // ... MIGHT WISH TO ENABLE PULL-UP RESISTERS HERE ...
    }

    for ( int i = ASIZEOF(pinsSwitches); i--; )
    {
        pinMode(pinsSwitches[i], INPUT);

        // ... MIGHT WISH TO ENABLE PULL-UP RESISTERS HERE ...
    }

    // ... THE KEYBOARD CONNECTS TO THE SYSTEM HOW ???? ...
}

@lloyddean i am from europe,and tomorrow in the morning i will test this , i jope to work .

Anyway thank you very very very much

re is NOTHING to test. It is simply a framework from which you might find useful as a starting point!

What does the keyboard do? Also that motor should not be connected directly to the arduino. If you want to drive that motor, you will need a NPN transistor, 2 resistors (1K, 10K) and an outside voltage source, NOT the 5 volts from the arduino!

@lloyddean,
Why are you using uint8_ts instead of byte?

Because that is the declaration of 'pinMode', 'digitalRead', 'digitalWrite', 'analogRead', 'analogWrite' and several others ...

EDIT -

As declared in Arduino.h ...

void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
int digitalRead(uint8_t);
int analogRead(uint8_t);
void analogReference(uint8_t mode);
void analogWrite(uint8_t, int);

... although I'm not a fan of leaving out the parameter name and would prefer ...

void pinMode(uint8_t pin, uint8_t mode);
void digitalWrite(uint8_t pin, uint8_t state);
int digitalRead(uint8_t pin);
int analogRead(uint8_t pin);
void analogReference(uint8_t mode);
void analogWrite(uint8_t pin, int value);

... to help document the functions parameters.

A keyboard is from computer , that was a exam , and tomorrow i will do it for my examination .

I told keyboard is from computer [ready] ,and i need and this code .

That code has 3 errorrs :

sketch_may09b:29: error: expected `}' before 'pinLED_4'
sketch_may09b:29: error: expected ',' or ';' before 'pinLED_4'
sketch_may09b:29: error: expected declaration before '}' token

Alls I can say is you're in trouble and wish you good luck!

Hard to believe people aren’t jumping at the chance to do your assignment for you.

Brothers thanks all to you , yes i know cant search all code from you , but this is my first time to work in arduino , and in lessons i missed becuase i was sick.

Sincerely thank you all ,thank you @lloyddean

Yes, it's amazing how many 'sick' students are out there!!!

james889:
Brothers thanks all to you , yes i know cant search all code from you , but this is my first time to work in arduino , and in lessons i missed becuase i was sick.

Sincerely thank you all ,thank you @lloyddean

If you were sick that much for your class, instead of taking (and failing because you weren't in class to learn the material) the exam, you should probably ask the professor to give you an incomplete for the course and re-take it. It sucks, but if you couldn't learn anything from the class because of outside events, you shouldn't expect to be handed a grade you couldn't earn. If you honestly couldn't do the class work because of an illness (or injury), you should work with your instructor. The good instructors (and most of them are) want you to succeed by honest means.

james889:
I dont tread rules of this forum ...

That is certainly sad.

james889:
A keyboard is from computer , that was a exam , and tomorrow i will do it for my examination .

You have much bigger problems than that exam.
1 day before the exam and you start to ask for help. You were sick before the project was assigned? Consider before you answer that no one here can save your exam. It is tomorrow already and you have a lifetime of tomorrows coming.

You don't have to 'look good' so why not 'be real' just because being real gives you a real chance to not have this happen to you again. Yah, it comes down to you and none of us here. Please help yourself, get the incomplete and come back ready to work your brains hard. It will do you a lot of good and when you learn, you 'look good'.

Have we had "the dog ate my Arduino" excuse yet?

HazardsMind:
@lloyddean,
Why are you using uint8_ts instead of byte?

Did my reply above answer your question adequately?

lloyddean:

HazardsMind:
@lloyddean,
Why are you using uint8_ts instead of byte?

Did my reply above answer your question adequately?

No, not really, well unless an uint8_t takes up less memory than a byte.
For anything being assigned to a pin, it should be a byte, it saves memory even if it is just one byte less. For anything that actually requires more memory usage like an int or long, signed or unsigned, fine, but a regular pin should be a byte.

I'm curious as to what the compiler makes a #define variable.
Edit: -_- iPhone spell check.

Well, it's not 'define'd, again referencing "Arduino.h"

typedef uint8_t byte;