9. Why raspbbery pi
Name Arduino
Raspberry Pi
A+
Raspberry Pi
B+
Raspberry Pi
2
Beaglebone
Black
Price $29.95 $20 $35 $35 $45
Processor ATMega 328 ARM 11
ARM
Cortex A7
ARM
Cortex A8
Clock Speed 16Mhz 700 Mhz 900 Mhz
1 Ghz
RAM 2KB 256MB 512MB 1GB 512MB
Multi Core Single Single Single Quad Single
Flash 32KB SD Card SD Card SD Card SD Card
GPIO 26 40 40 40 92
Ethernet N/A 10/100 10/100 10/100 10/100
USB N/A USB 2.0 x 1 USB 2.0 x 4 USB 2.0 x4 USB 2.0 x 1
Video Out N/A HDMI, Composite N/A
Audio Out N/A HDMI, Analog Analog
11. The maker culture is a contemporary culture or subculture
representing a technology-based extension of DIY culture.
Typical interests enjoyed by the maker culture include
engineering-oriented pursuits such as electronics, robotics,
3-D printing, and the use of CNC tools,[1] as well as more
traditional activities such as metalworking, woodworking,
and traditional arts and crafts. The subculture stresses new
and unique applications of technologies, and encourages
invention and prototyping.[2] There is a strong focus on
using and learning practical skills and applying them
creatively
Maker
68. ๋จ์ถํค
ํ์ ๋จ์ถ ํค ๋์
^G CTRL + G CTRL + G
^O CTRL + O Write Out
^Y CTRL + Y Prev Page
^K CTRL + K Cut Text
^C CTRL + C Cursor Position
^X CTRL + X Exit
^W CTRL + W Where Is
^V CTRL + V Next Page
^V CTRL + U Un cut text
^T CTRL + T To Spell
87. Expressjs
.nodejs ๋ฅผ ์ํ ์น ์ ํ๋ฆฌ์ผ์ด์ ํ๋ ์์ํฌ๋ก, ํ๋ ํน์ธ
์ฌ๋ฌ ์น ํ์ด์ง๋ฅผ ๋ง๋ค๊ฑฐ๋ ํ์ด๋ธ๋ฆฌ๋ ์น ์ดํ๋ฆฌ์ผ์ด์ ์
์ํ ๊ธฐ๋ฅ๋ค์ ์ ๊ณตํจ
var express = require(โexpressโ);
var app = express();
app.get(โ/โ, function(req, res){
res.send(โhello world!โ)
});
var server = app.listen(3000, function(){
var host = server.address().address;
var port = server.address().port;
console.log(โExpressJS example at http://$s:$sโ, host, port);
});
88. ๊ธฐ๋ณธ ๋ผ์ฐํ
.HTTP ์์ฒญ ๋ฉ์๋ GET, POST, PUT, DELETE ์ ๋ํด ๊ธฐ๋ณธ์
์ธ ๊ธฐ๋ฅ์ผ๋ก ๊ฐ๋จํ๊ฒ ๊ตฌํ ๊ฐ๋ฅ
// respond with "Hello World!" on the homepage
app.get('/', function (req, res) {
res.send('Hello World!');
});
// accept POST request on the homepage
app.post('/', function (req, res) {
res.send('Got a POST request');
});
// accept PUT request at /user
app.put('/user', function (req, res) {
res.send('Got a PUT request at /user');
});
// accept DELETE request at /user
app.delete('/user', function (req, res) {
res.send('Got a DELETE request at /user');
});
89. ๊ธฐ๋ณธ ๋ผ์ฐํ
.HTTP ์์ฒญ ๋ฉ์๋ GET, POST, PUT, DELETE ์ ๋ํด ๊ธฐ๋ณธ์
์ธ ๊ธฐ๋ฅ์ผ๋ก ๊ฐ๋จํ๊ฒ ๊ตฌํ ๊ฐ๋ฅ
// a middleware sub-stack which handles GET requests to /user/:id
app.get('/user/:id', function (req, res, next) {
// if user id is 0, skip to the next route
if (req.params.id == 0) next('route');
// else pass the control to the next middleware in this stack
else next(); //
}, function (req, res, next) {
// render a regular page
res.render('regular');
});
// handler for /user/:id which renders a special page
app.get('/user/:id', function (req, res, next) {
res.render('special');
});
90. ๊ณ ๊ธ ๋ผ์ฐํ
.4.x ๋ถํฐ ์๋กญ๊ฒ ์ถ๊ฐ๋ router ๊ธฐ๋ฅ์ ํ์ฉํ ์ ์์
var app = express();
var router = express.Router();
// a middleware with no mount path, gets executed for every request to the router
router.use(function (req, res, next) {
console.log('Time:', Date.now()); next();
});
// a middleware sub-stack shows request info for any type of HTTP request to /user/:id
router.use('/user/:id', function(req, res, next) {
console.log('Request URL:', req.originalUrl);
next();
}, function (req, res, next) {
console.log('Request Type:', req.method);
next();
});
91. ๊ณ ๊ธ ๋ผ์ฐํ
.4.x ๋ถํฐ ์๋กญ๊ฒ ์ถ๊ฐ๋ router ๊ธฐ๋ฅ์ ํ์ฉํ ์ ์์
// a middleware sub-stack which handles GET requests to /user/:id
router.get('/user/:id', function (req, res, next) {
// if user id is 0, skip to the next router
if (req.params.id == 0) next('route');
// else pass the control to the next middleware in this stack
else next(); //
}, function (req, res, next) {
// render a regular page
res.render('regular');
});
// handler for /user/:id which renders a special page
router.get('/user/:id', function (req, res, next) {
console.log(req.params.id);
res.render('special');
});
// mount the router on the app
app.use('/', router);
96. SocketIO
var io = require('socket.io').listen(80);
io.sockets.on('connection', function (socket) {
socket.on('ferret', function (name, fn) {
fn('woot');
});
});
Server side example
97. SocketIO
var io = require(โsocket.ioโ).listen(80);
io.sockets.on(โconnectionโ, function (socket) {
socket.broadcast.emit(โuser connectedโ);
});
Server side example