Skip to content
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

HelloWorld #27

Open
totovr opened this issue May 4, 2018 · 0 comments
Open

HelloWorld #27

totovr opened this issue May 4, 2018 · 0 comments

Comments

@totovr
Copy link

totovr commented May 4, 2018

Hello! I'm trying to setup the hello world example but the Arduino is not interacting with the browser, also I can not install the p5bots-server, instead of it I'm using http-server of node.

index.html:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Led</title>
</head>

<body>
  <!-- <script src="https://cdn.socket.io/socket.io-1.3.5.js"></script> -->
  <script src="libraries/socket.io-1.4.5.js" type="text/javascript"></script>
  <script src="libraries/p5.js" type="text/javascript"></script>
  <script src="libraries/p5bots.js" type="text/javascript"></script>
  <script src="sketch.js"></script>
</body>

</html>

sketch.js:

var b = p5.board('/dev/cu.usbmodemFA131', 'arduino');
var led;

function setup() {
  led = b.pin(13, 'LED');
}

function keyPressed() {
  if (keyCode === LEFT_ARROW){
    led.on();
  } else if (keyCode === RIGHT_ARROW) {
    led.off();
  } else if (keyCode === UP_ARROW){
    led.blink();
    console.log('Hello, World!');
  } else if (keyCode === DOWN_ARROW) {
    led.noBlink();
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant