31.07.2015 Views

A-Teachers-Guide-to-the-Intel-Galileo-Final

A-Teachers-Guide-to-the-Intel-Galileo-Final

A-Teachers-Guide-to-the-Intel-Galileo-Final

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A TEACHER’S GUIDE TO THE INTEL® GALILEO | 54IndentationIn Python, <strong>the</strong> way <strong>the</strong> program is formatted means something when <strong>the</strong> program is run. Thisis different from o<strong>the</strong>r languages like Java and C or C++. Code with <strong>the</strong> same indentation isconsidered <strong>to</strong> be in <strong>the</strong> same block. So in python <strong>the</strong>re is no need <strong>to</strong> use an opening and closingbrace <strong>to</strong> ‘block’ out some code. In python <strong>the</strong> number of whitespaces will determine which codegoes with which.Python Resources:www.codeacademy.comwww.sthurlow.comwww.learnpython.orghttp://inventwithpython.com/chapters/http://python.orgJavascript and Node.js on <strong>the</strong> <strong>Galileo</strong>OverviewThis activity involves coding up a simple web server on <strong>the</strong> <strong>Galileo</strong> using node.js. There is nohardware involved.Materials»»1 x <strong>Intel</strong>® <strong>Galileo</strong> Gen 2 board»»1 x 12V Power supply»»1 x Micro USB leadCodingAs part of <strong>the</strong> standard Linux image supplied with <strong>the</strong> <strong>Intel</strong>® <strong>Galileo</strong> <strong>the</strong>re is something callednode.js. Node.js is an environment that allows you <strong>to</strong> build high performance and scalablenetwork applications in <strong>the</strong> Javascript language. Programs in node.js are written in Javascript.Javascript is a programming language that is built in<strong>to</strong> all <strong>the</strong> major web browsers and used <strong>to</strong>make web pages interactive. Javascript is often embedded in HTML using <strong>the</strong> tag. Thereare plenty of pre-written Javascripts that you can copy and plug straight in<strong>to</strong> your web page.Here is a simple html file with some embedded Javascript:function functionOne() { alert('You clicked <strong>the</strong> <strong>to</strong>p text'); }function functionTwo() { alert('You clicked <strong>the</strong> bot<strong>to</strong>m text'); }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!