Skip to Content
iPhone & iPad電子專案製作|透過techBasic開發Arduino、感測器與藍牙應用
book

iPhone & iPad電子專案製作|透過techBasic開發Arduino、感測器與藍牙應用

by Mike Westerfield
August 2016
Beginner to intermediate
336 pages
6h 28m
Chinese
GoTop Information, Inc.
Content preview from iPhone & iPad電子專案製作|透過techBasic開發Arduino、感測器與藍牙應用
260
|
第十章:向兵乓致敬:藍牙遊戲 Paddles
主軟體 Paddles
到程式問答網站 Stack Overflow 及在我的電子郵件收件匣裡,常看到的問題之一是如何
同時與兩台低功耗藍牙裝置溝通。而本章範例遊戲 Paddles 正具備此種能力,它會與兩台
代表球拍的低功耗藍牙遊戲手把進行傳輸。
Paddles 是本書第一支遊戲範例,關於遊戲操縱感受的處理,有一些有趣的面向,可讓這
支遊戲變得更好玩、更加真實。
除了少數幾個例外之外,本節的程式並沒有新東西,如果讀者想要了解如何設置裝置,
或是想學 習如何以 techBASIC 言撰寫遊戲 程式, 請繼續閱讀,否則 過本節也
係。
! 這支程式實作電子版的桌球,
! 也稱為乒乓球,需要兩台 iPhone、一台 iPad
! 都必須具備 BLE 功能。詳情請見本章開頭的說明。
DIM quitButton AS Button
DIM leftScoreLabel AS Label, rightScoreLabel AS Label, g
ameTime AS Label
DIM leftScore, rightScore
DIM leftPaddle AS BLEPeripheral, rightPaddle AS BLEPeripheral
DIM leftPaddleLabel AS Label, rightPaddleLabel AS Label
DIM ballLabel AS Label
leftServiceUUID$ = "7240D580-B108-11E2-9E96-0800200C9A66" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Geolocation in iOS

Geolocation in iOS

Alasdair Allan
算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow

Publisher Resources

ISBN: 9789864761098