Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Dec 8, 2018
1 parent c12f187 commit ee2ebc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions kek.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,37 @@ let currentAngle = 0;

const move = amount => {
let newAngle = currentAngle + amount;
let response = 'OK';

if (newAngle > 180) {
newAngle = 180;
response = 'MAX LEFT';
}

if (newAngle < 0) {
newAngle = 0;
response = 'MAX RIGHT';
}

currentAngle = newAngle;

piblaster.setServoPwm("P1-13", angleToPercent(currentAngle) + "%");
console.log("Setting at: ", currentAngle, angleToPercent(currentAngle));

return response;
};

return (module.exports = {
left() {
move(10);

return 'OK LEFT';
//return 'OK LEFT';
},

right() {
move(-10);

return 'OK RIGHT';
//return 'OK RIGHT';
},

shoot() {
Expand Down
8 changes: 4 additions & 4 deletions webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const { left, right, shoot } = require("./kek");

app.get('/left', function (req, res) {

console.log(left());
res.send('OK');
const response = left();
res.send(response);
});

app.get('/right', function (req, res) {

console.log(right());
res.send('OK');
const response = right();
res.send(response);
});

app.get('/shoot-that-mofo', function (req, res) {
Expand Down

0 comments on commit ee2ebc6

Please sign in to comment.