programming 2 introduction...you use to create pc applications –compile and run your programs and...
TRANSCRIPT
![Page 1: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/1.jpg)
Making Gadgets
Rob Miles
Department of Computer Science
University of Hull
![Page 2: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/2.jpg)
2
Agenda
• What makes a gadget?
– What do gadgets do that make things interesting?
• Computers for Gadgets
• Interfacing with the outside world
• Printing boxes for your gadgets
• Making your own gadgets
![Page 3: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/3.jpg)
3
Gadgets all around
• The human race has always been all about tools
• From the plough, to the wheel, to the Apple iPad, we have surrounded ourselves with gadgets
![Page 4: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/4.jpg)
4
What makes a Gadget?
• The first gadgets were mechanical
• You can still get mechanical ones now
• But today most gadgets have an electronic component
Gadget: Noun - A small mechanical device or tool, esp. an ingenious or novel one.
![Page 5: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/5.jpg)
5
.NET for Multiple Device types
• You might think of C#, Visual Studio and .NET as tools that you use to create PC applications
– Compile and run your programs and run them on your desktop or laptop
• However, there is more to .NET than this
– You are probably aware that you can write .NET applications for your Windows Mobile device
• But now you can also target all kinds of devices
Micro Framework Overview
![Page 6: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/6.jpg)
Windows
Tablet PC
Notebook PC
The Windows PC
![Page 7: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/7.jpg)
Windows
Tablet PC
Notebook PC
Point of Sale
Medical Devices
ATMS & Kiosks
Machine Control
Industrial Automation
Thin Clients
Embedded Windows
![Page 8: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/8.jpg)
Windows
Tablet PC
Notebook PC
Point of Sale
Medical Devices
ATMS & Kiosks
Machine Control
Industrial Automation
Thin Clients
Windows Mobile
Smartphone Windows Mobile
Pocket PC Phone
Windows Automotive
Zune
VoIP Phones
Mobile
Handhelds
Set-top Boxes
Windows Embedded CE
![Page 9: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/9.jpg)
Windows
Tablet PC
Notebook PC
Wearable Devices
Auxiliary Displays
Remote Controls
Sensor Networks
Point of Sale
Medical Devices
ATMS & Kiosks
Machine Control
Industrial Automation
Thin Clients
Windows Mobile
Smartphone Windows Mobile
Pocket PC Phone
Windows Automotive
Zune
VoIP Phones
Mobile
Handhelds
Set-top Boxes
.NET Micro Framework
![Page 10: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/10.jpg)
10
Platforms and Hardware
Windows Vista Windows XP Embedded
Windows CE .NET Micro Framework
Device Features
Connected, PC Class Performance, Accelerated Graphics
Connected, PC Class Performance
Connected, Graphical UI, Server, Browser, RAS DirectX
Connected, Small, Wearable, Graphical UI
Development Visual Studio + C# .NET Framework
Visual Studio + C# .NET Framework
Visual Studio + C# .NET Compact Framework
Visual Studio + C# .NET Micro Framework
Footprint X86 Dual Core, 64 Bit, Multi Processor
X86 X86, MIPS, SH4, ARM, with MMU, 12 MB, Managed Code
ARM 7, ARM 9, No MMU, 250-500KB, Managed Code
Power
Mains Mains Low Power Very Low Power
![Page 11: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/11.jpg)
11
Platforms and Hardware
Windows Vista Windows XP Embedded
Windows CE .NET Micro Framework
Device Features
Connected, PC Class Performance, Accelerated Graphics
Connected, PC Class Performance
Connected, Graphical UI, Server, Browser, RAS DirectX
Connected, Small, Wearable, Graphical UI
Development Visual Studio + C# .NET Framework
Visual Studio + C# .NET Framework
Visual Studio + C# .NET Compact Framework
Visual Studio + C# .NET Micro Framework
Footprint X86 Dual Core, 64 Bit, Multi Processor
X86 X86, MIPS, SH4, ARM, with MMU, 12 MB, Managed Code
ARM 7, ARM 9, No MMU, 250-500KB, Managed Code
Power
Mains Mains Low Power Very Low Power
![Page 12: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/12.jpg)
12
Platforms and Hardware
Windows Vista Windows XP Embedded
Windows CE .NET Micro Framework
Device Features
Connected, PC Class Performance, Accelerated Graphics
Connected, PC Class Performance
Connected, Graphical UI, Server, Browser, RAS DirectX
Connected, Small, Wearable, Graphical UI
Development Visual Studio + C# .NET Framework
Visual Studio + C# .NET Framework
Visual Studio + C# .NET Compact Framework
Visual Studio + C# .NET Micro Framework
Footprint X86 Dual Core, 64 Bit, Multi Processor
X86 X86, MIPS, SH4, ARM, with MMU, 12 MB, Managed Code
ARM 7, ARM 9, No MMU, 250-500KB, Managed Code
Power
Mains Mains Low Power Very Low Power
![Page 13: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/13.jpg)
.NET Framework on Windows
Services
•Description
•Discovery
•Protocols
UI Controls
•HTML
•Web
Runtime
•Interop
•Remoting
•Serialization
Design
Configuration
Cache
Session state
Security
Imaging
Drawing 2D
Text
Printing
Design
ADO.NET
SQL ServerCE
SQL Client
Xslt/XPath
XML Document
Reader/writers
Serialization
Service process
Configuration
Threading
Diagnostics
Net
IO
Resources
Reflection
Security
Collections
Globalization
Text
Component model
System.Drawing
System.Windows.Forms System.Web
System.Data System.XML
System
![Page 14: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/14.jpg)
.NET Compact Framework
Services
•Description
•Discovery
•Protocols
UI Controls
•HTML
•Web
Runtime
•Interop
•Remoting
•Serialization
Design
Configuration
Cache
Session state
Security
Imaging
Drawing 2D
Text
Printing
Design
ADO.NET
SQL ServerCE
SQL Client
Xslt/XPath
XML Document
Reader/writers
Serialization
Service process
Configuration
Threading
Diagnostics
Net
IO
Resources
Reflection
Security
Collections
Globalization
Text
Component model
System.Drawing
System.Windows.Forms System.Web
System.Data System.XML
System
![Page 15: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/15.jpg)
.NET Micro Framework
Services
•Description
•Discovery
•Protocols
UI Controls
•HTML
•Web
Design
Configuration
Cache
Session state
Security
Imaging
Drawing 2D
Text
Printing
Design
ADO.NET
SQL ServerCE
SQL Client
Xslt/XPath
XML Document
Reader/writers
Serialization
Service process
Configuration
Threading
Diagnostics
Net
IO
Resources
Reflection
Security
Collections
Globalization
Text
Component model
System.Drawing
System.Windows.Forms System.Web
System.Data System.XML
System
Interop
Runtime
Serialization
Remoting
![Page 16: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/16.jpg)
16
The Missing Operating System
• A device powered by the .NET Micro Framework does not have/need an operating system
• Programs execute directly on the hardware using a "Bootable Run Time System"
– Simplifies deployment – Reduces the demands on the target platform
• Programs still have access to many parts of the .NET API
– Provided by the run-time system rather than an operating system
![Page 17: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/17.jpg)
17
How it works
• C# source is compiled to Intermediate Language (MSIL)
• The MSIL is downloaded in a compressed form and interpreted in the Micro Framework device
• As far as the code is concerned it is running inside a standard .NET Assembly
• The program runs as soon as the device is powered up
![Page 18: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/18.jpg)
18
The .NET Framework Scope
• Not all .NET devices support all the components of the full .NET Framework
– This is quite sensible given the limitations of the platforms and the needs of the solutions
• However, all the fundamentals of .NET are present on all of the platforms
– And they are used in exactly the same way in your applications
– And there are special purpose libraries
![Page 19: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/19.jpg)
19
Objects and Hardware
• Input and output connections are managed by objects
• The output port object provides a method you can use to set the state of the pin
• You can also create ports which generate interrupts when they are triggered
– These make use of delegates to despatch the interrupt event
• There are built in hardware abstractions for RS232, I2C, SPI and LCD
![Page 20: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/20.jpg)
20
Reading an Input Pin
// Map the pin to the software Cpu.Pin switchPin = Cpu.Pin.GPIO_Pin2; // Create a port connected to a pin InputPort switchInput = new InputPort( switchPin, //pin false, //no glitch filter Port.ResistorMode.PullUp); // Use the pin If (switchInput.Read()) { Debug.Print("input high"); }
![Page 21: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/21.jpg)
21
Graphical Displays
• The .NET Micro Framework has comprehensive graphical output facilities for driving device displays
• The facilities are provided at two levels:
– Bitmap class provides a range of simple drawing facilities (shapes, images, text)
– Windows Presentation Foundation (WPF) inspired set of display elements that can be used to create complex displays
![Page 22: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/22.jpg)
22
The Emulator
• A program that interprets the Micro Framework code
• Provides very comprehensive debugging support
• A set of standard component emulations are included:
– LCD display – General Purpose Input/Output – Serial port – I2C port
![Page 23: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/23.jpg)
23
Extending the Emulator
• You can also create your own component emulations which can be integrated into your environment
• All this is done in C# by extending the existing emulator and component classes in your project
• You can easily build up a library of device and component emulations which can be shared across projects
![Page 24: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/24.jpg)
24
The Hull Emulator
• I have created a custom emulator for use at Hull
• It provides a set of input and output ports that you can use to test your programs
• It also provides a simulated serial port connection for testing programs that connect to other systems
![Page 25: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/25.jpg)
25
Gadgeteer
• This is a Microsoft Gadgeteer device
• It is powered by the .NET Micro Framework but provides a much easier way to interface devices
• This side has all the sockets
![Page 26: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/26.jpg)
26
Computers for Gadgets
• This side has the processor
• You could create an embedded device on your own PC and then just add this processing element
• This makes the Gadgeteer devices great for prototyping
![Page 27: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/27.jpg)
27
Plenty of connections
• We can connect a device to each of the sockets
• Power goes into socket number 1
• Some devices use several sockets
• Each socket has a
![Page 28: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/28.jpg)
28
So, how do we make Gadgets?
• To make a gadget we have to program the processor (the bit in the middle) with the software that will make it do what we want
• We also have to work out which devices fit into which sockets
• We use a tool called Visual Studio to do this
• It has a Gadget design surface that connects the components together
![Page 29: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/29.jpg)
29
Wiring up a camera
• These are the connections for a simple digital camera
• It uses an LCD panel, a camera sensor and a button
• Once we have the sensors connected we can write the code
![Page 30: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/30.jpg)
30
Responding to Events
• These two program statements “wire” methods up to events that the components generate
– The first one fires a method when a button is pressed – The second one fires a method when the camera has a
picture ready
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed); camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
![Page 31: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/31.jpg)
31
Responding to the button event
• This is the C# code that runs when the user presses the button
• It just asks the camera to take a picture
• The camera is represented by a software object that contains methods a program can use to ask it to do things
void button_ButtonPressed(Button sender, Button.ButtonState state) { camera.TakePicture(); }
![Page 32: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/32.jpg)
32
Responding when the picture is ready
• This is the C# code that runs when the camera has a picture ready
• The camera will run this method when the picture arrives
• The method just takes the picture that was received and puts it on the screen
void camera_PictureCaptured(Camera sender, GT.Picture picture) { display.SimpleGraphics.DisplayImage(picture,0,0); }
![Page 33: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/33.jpg)
33
Is that all there is?
• This is all the code we need to write to create a digital camera
• We could change the software
– Make a self timer that waits a few seconds before taking the picture
– Make the camera take a sequence of shots rather than just one, then let you pick the best
– Turn the picture into black and white – Combine two pictures so you can be in the same scene
twice
![Page 34: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/34.jpg)
“Make a Camera” Demo 1: Creating a Camera from Scratch
![Page 35: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/35.jpg)
35
Gadgeteer Devices
• The camera used a number of devices
– The camera – The button – The LCD panel
• We could add others
– Add an SD card to save the picture – Add a network connection to put the picture on the web
• There are lots of devices we can use?
![Page 36: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/36.jpg)
36
What do we mean by device?
• There are lots of devices
![Page 37: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/37.jpg)
37
What do we mean by device?
• ..and lots
![Page 38: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/38.jpg)
38
• ..and lots
![Page 39: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/39.jpg)
39
What do we mean by device?
• LCD panel with touch screen input
– A gadget can display text and graphics – Not all gadgets need a display though, many are
“headless”
![Page 40: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/40.jpg)
40
What do we mean by device?
• Coloured LED
– The LED can be programmed change colour and flash automatically
![Page 41: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/41.jpg)
41
What do we mean by device?
• Video Camera
– A gadget can take pictures of its surroundings
![Page 42: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/42.jpg)
42
What do we mean by device?
• Network Connection
– A gadget can connect to a wired network and send and receive data
![Page 43: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/43.jpg)
43
What do we mean by device?
• Push button
– The user can make things happen by pressing the button – This can start a program running inside the gadget
![Page 44: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/44.jpg)
44
What do we mean by device?
• WiFi connection
– Gadgets can send and receive information over wireless networks
![Page 45: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/45.jpg)
45
What do we mean by device?
• Memory Card
– Gadgets can store data in an SD card or read data back from it
![Page 46: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/46.jpg)
46
What do we mean by device?
• Interface expander
– Gadgets can connect directly to other devices – We will use this to connect a printer
![Page 47: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/47.jpg)
47
What do we mean by device?
• USB Host
– Gadgets can connect to lots of other peripherals, for example mice or keyboards
![Page 48: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/48.jpg)
48
What do we mean by device?
• Joystick
– Users can control their gadgets using a joystick
![Page 49: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/49.jpg)
49
What do we mean by device?
• Potentiometer
– Users can control their gadgets turning a knob
![Page 50: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/50.jpg)
50
What do we mean by device?
• USB connector
– Links a Gadget to another computer
![Page 51: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/51.jpg)
51
What do we mean by device?
• Accelerometer
– A Gadget can read the acceleration acting on it at any time
![Page 52: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/52.jpg)
52
What do we mean by device?
• Barometer
– A Gadget can measure air pressure
![Page 53: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/53.jpg)
53
What do we mean by device?
• CAN interface
– A Gadget can connect to industrial machinery
![Page 54: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/54.jpg)
54
What do we mean by device?
• Bluetooth interface
– A Gadget can connect to all kinds of Bluetooth devices
![Page 55: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/55.jpg)
55
What do we mean by device?
• Mobile Phone
– A Gadget can send and receive data over the mobile phone network
![Page 56: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/56.jpg)
56
What do we mean by device?
• Compass
– A Gadget can work out which way is north
![Page 57: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/57.jpg)
57
What do we mean by device?
• Current sensor
– A Gadget can discover the amount of power a circuit is using
![Page 58: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/58.jpg)
58
What do we mean by device?
• GPS receiver
– A gadget can tell where it is
![Page 59: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/59.jpg)
59
What do we mean by device?
• Gyroscope
– A gadget can tell where if it is turning
![Page 60: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/60.jpg)
60
What do we mean by device?
• Input Expansion
– A gadget can control lots of other devices
![Page 61: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/61.jpg)
61
What do we mean by device?
• Remote Control
– Your gadget can be remote controlled
![Page 62: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/62.jpg)
62
What do we mean by device?
• Light Matrix Control
– Your gadget can drive 64 multi-coloured and ultra-bright LEDs
![Page 63: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/63.jpg)
63
What do we mean by device?
• Soil moisture sensor
– Your gadget can water your plants
![Page 64: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/64.jpg)
64
I could go on…
• There are also devices which can
– Measure your heartbeat – Detect intruders – Measure temperature – Sense Light – Output video – Play Music
• These all connect via the sockets that you see on the processor board
![Page 65: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/65.jpg)
65
Making Gadgets is easy
• Each of the devices connects to the computer in the same way, and we have a “software object” that represents the device
• We write programs that interact with the object
• There are basically two kinds of program that we make
– Ones that respond when the user does something (take a picture when the user presses a button)
– Ones that perform a task regularly (read the air pressure and then send it to a server on the network)
![Page 66: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/66.jpg)
66
Rob’s Twitter Printer
• I thought it might be fun to create a program that prints my tweets off Twitter
• I can use a Gadgeteer device to do this, arranged as you see above
![Page 67: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/67.jpg)
“Printing Tweets” Demo 2: A Twitter Printer
![Page 68: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/68.jpg)
68
Summary
• Computer controlled gadgets are easy and fun to make
• There is a huge range of different devices you can connect to
• A program can run in response to a stimulus, or at regular intervals
• You can now use 3D printers to produce the cases for your devices
![Page 69: Programming 2 Introduction...you use to create PC applications –Compile and run your programs and run them on your desktop or laptop •However, there is more to .NET than this –You](https://reader034.vdocument.in/reader034/viewer/2022050513/5f9d47bed1d48872057deefd/html5/thumbnails/69.jpg)
69
Useful Stuff
• Gadgeteer Hardware and Software
– http://www.netmf.com/gadgeteer/ – http://www.ghielectronics.com/
• Free 3D Design Tools
– http://sourceforge.net/projects/free-cad/ – http://www.123dapp.com/
• 3D Printers
– http://www.ultimaker.com/
• My Blog
– http://www.robmiles.com