![]() It outputs to standard output, which is a text display device (real or virtual) for most computer systems. Code to Note The Console ObjectĬonsole is a special object that has been pre-defined elsewhere in our JavaScript environment. Why is this simple phrase monumental? Well, it means all our preparing and configuring worked! We wrote a simple program, sent it to the Edison, and had the Edison run it. Just connect the USB cable from your computer to the Console Port on the stack you made in Building the Block Stack. We will be using the special console object to output text to the screen. For now, know that objects are containers for properties and methods. This might be a lot to take in, but never fear! We will revisit these concepts over the course of these experiments. Ultimately, calling dog.bark() prints woof to the screen. In this case, console.log("woof") prints the word woof to the screen. The function then, ideally, uses that value in its own code. In this case, "woof" is a string (as noted by the double quotes), which is a collection of characters. "woof" is a parameter, which is a value that is passed to a function. By calling console.log() we can print something to the screen (assuming we have access to some kind of text output console). it is an object that always exists when we run the program).log() is a method of the console object. console is a special object that is known by most implementations of JavaScript (i.e. If we dig into the bark() method, we see that it contains console.log("woof"). Because bark() is a function inside an object, it is known as a method (functions not part of objects are just called functions). They can also be used to pass parameters to the function, which we will see in a minute. The parentheses () after dog.bark let us know that it is a function. Functions are actions! They cause the object to do something. In addition to our name and color properties, we also defined a function as a property. If we wanted to get the name of our dog object, we could access that property with: language:javascript We create a property called name and assign it the value "Roland". In this case, we are storing our object (a collection of properties) in a storage container called dog.Īll of the properties for this object are defined between the outside set of curly braces. In this example, we created a variable (as noted by the keyword var) called dog. If we wanted to make a JavaScript version of our dog, we might write something like: language:javascript OK, so how does this translate to the programming world? In most object-oriented languages, an object is a collection of data (bytes stored somewhere on the computer) that has been grouped together and wrapped up in a way that makes for easy access. Dogs can also do things, like bark, sleep, play, etc. A dog, for example, is a type of object.Ī dog has properties, such as a breed, a fur color, a name, and so on. What is an object? In the real world, an object is just another word for a thing. In JavaScript almost everything is an object. Reading about the history of OOP might be enlightening and entertaining.Ĭoncepts A Very Light Introduction to Objects ![]() Oject-Oriented Programming (OOP) - JavaScript relies on objects to get work done.JavaScript Syntax - Whether you are new to JavaScript or a seasoned developer, you might want to look at how JavaScript statements are structured.You will need the Edison and Block stack that we constructed in Building the Block Stack section. We can test all these things with one line of code! Parts Needed We spent quite some time installing the XDK, flashing new firmware, and configuring the Edison. We realize that starting with "Hello, World!" is a cliché in the programming world, but it really is the perfect starting place with the XDK and Edison. Intel's Getting Started Guide - Tutorial on how to get the Edison running with either the Arduino Breakout Board or the Mini Breakout Board.Įach experiment will also have a Suggested Reading section to aid you in understanding the components and concepts used in that particular experiment.General Guide to SparkFun Blocks for Intel® Edison - Describes how the Blocks work with the Edison and provides a brief overview of all the available Blocks.Edison Getting Started Guide - A quick way to program the Edison using the Arduino IDE.The following links may help guide you in your journey through the Edison SIK. If, at any time, you are unsure which part a particular experiment is asking for, reference this section. 1x Basic 16x2 Character LCD - White on Black 3.3V.1x SparkFun Block for Intel® Edison - ADC.1x SparkFun Block for Intel® Edison - GPIO.1x SparkFun Block for Intel® Edison - Base.The SparkFun Inventor's Kit for Intel® Edison includes the following: ![]()
0 Comments
Leave a Reply. |