0
#include <iostream>

using namespace std;


int main() 

{

// declaring variables:
int MotorControl;
int MotorRotation;


MotorControl = on;
MotorControl = off;

 // process motor control and rotation

  MotorRotation = clockwise;
  MotorRotation = Anti-clockwise;


  Motor::setRotation(uint8_t direction)
    {
    if(rotation == clockwise)
            {

      Motor_Control_port &amp;= ~(uint16_t) Motor_Rotation; // PD15 motor direction - clockwise

   }
        else if(direction == anticlockwise) 
            {
    Motor_Control_port |= (uint16_t) Motor_Rotation; // PD15 motor direction - anticlockwise


  MotorControl = on;
  MotorControl = off;

void Motor::on() {

Motor_Control |= (uint16_t) Motor_Control; // PD12 motor control - on
}

void Motor::off() {
 Motor_Control_port &amp;= ~(uint16_t) Motor_Control; // PD12 motor control -off

}

the error I have got is the following:

 In function 'int main()':
17:16: error: 'on' was not declared in this scope
18:16: error: 'off' was not declared in this scope
23:19: error: 'clockwise' was not declared in this scope
24:19: error: 'Anti' was not declared in this scope
27:3: error: 'Motor' has not been declared
27:30: error: expected primary-expression before 'direction'
58:1: error: expected '}' at end of input
5
  • For a start, I can see unbalanced brackets
    – Dirk
    Feb 15 '20 at 15:05
  • 2
    No relevance to the Pi.
    – joan
    Feb 15 '20 at 15:44
  • 2
    @M.salimy Even if you are compiling for a Raspberry Pi, I would expect more responses from C++ programmers stackoverflow.com. Consider your questions in terms of the compiler errors in terms of Why? I would not just post my code and errors with the expectation for the community to resolve the compiler errors: if you outsource it to others, you will not learn critical problem solving skills
    – gatorback
    Feb 15 '20 at 15:49
  • @moderator Maybe this post could be gently moved to a more appropriate venue like stackexchange?
    – gatorback
    Feb 15 '20 at 15:53
  • @M.salimy, start by fixing the bad code formatting ... the code is improperly indented ... the problem may become apparent to you when the code is cleaned up
    – jsotola
    Feb 15 '20 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.