Skip to content

Kifa #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Kifa #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main2.ino
mpu6050.ino
2 changes: 2 additions & 0 deletions main/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build/
.cache/
libraries/
FireFighter.cpp
Scanner.cpp
28 changes: 28 additions & 0 deletions main/DCMotor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "DCMotor.h"

void DCMotor::init() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENA, OUTPUT);

analogWrite(ENA, speed);
}
//start bl motor depending on speed percentage
void DCMotor::start(){
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
}

void DCMotor::stop(){
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
}

//*getters and setters*//
void DCMotor::setSpeed(int per){
speed = per;
}

int DCMotor::getSpeed(){
return speed;
}
23 changes: 23 additions & 0 deletions main/DCMotor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once // acts as header gaurd

#include <Arduino.h> // include arduino library

class DCMotor{

public:

void init(); //pin parameter

void start();
void stop();

void setSpeed(int per); //set speed, [-50 = fully counter-clock], [50 = fully clockwise]
int getSpeed();

private:
int speed = 255;
//pins >>>
int ENA = 9;
int IN1 = 23;
int IN2 = 25;
};
3 changes: 3 additions & 0 deletions main/Firefighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ void Firefighter::init() {

bool Firefighter::HtoA() { //TODO: in a untested state

<<<<<<< HEAD
=======

switch (stateHtoA) {

Expand Down Expand Up @@ -170,6 +172,7 @@ bool Firefighter::HtoA() { //TODO: in a untested state
break;

}
>>>>>>> 151a95d8515c89bda28bd48b81a4749f3cfc657d

return false; // not complete
}
Expand Down