EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #134 background imageLoading...
Page #134 background image
Finally, we import all the JavaScript code we need. The jQuery
5
library is a
very popular tool for creating dynamic web applications. It makes it very easy
to manipulate HTML elements, and itll make our life much easier.
You already know the
serial_device.js
and
game_controller.js
files. The
arduinoid.js
file
is more interesting because it contains the actual game logic. It starts with
the definition of a few data structures holding the games most important
status information:
BrowserGame/Arduinoid/js/arduinoid.js
const MAX_LIVES = 5;
var GameStates = {
RUNNING: 'running',
PAUSED: 'paused',
LOST: 'lost',
WON: 'won'
}
var Game = {
lives: MAX_LIVES,
score: 0,
state: GameStates.PAUSED,
paddle: {
speed: 15,
width: $("#paddle").width(),
height: $("#paddle").height()
},
playfield: {
width: $("#playfield").width(),
height: $("#playfield").height(),
rows: 4,
columns: 10
},
ball: {
diameter: $("#ball").width(),
vx: 5 + Math.random() * 5,
vy: -10
},
controller: new GameController('/dev/tty.usbmodem24321')
}
5.
http://jquery.com/
Chapter 7. Writing a Game for the Motion-Sensing Game Controller 116
report erratum discuss
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals