• CHAPTER 2 Android Geiger Counter T HE E VIL G ENIUS’S MINIONS
  • Arduino + Android Projects for the Evil Genius




    Download 22.85 Mb.
    Pdf ko'rish
    bet14/106
    Sana27.06.2022
    Hajmi22.85 Mb.
    #24472
    1   ...   10   11   12   13   14   15   16   17   ...   106
    Bog'liq
    Arduino-Android ProjectsfortheEvilGenius-SimonMonk

    The Android App
    The Android app is the more complex part of the project, and learning Android programming is a book in
    its own right. In fact, many such books are available. But at least we can have a little look at the section of
    code that sends the value to the Arduino.
    The interface is beautifully simple. You just call the method sendDataToArduino. The first argument
    is the Android Activity instance (think screen); the second argument is the Bluetooth ID of the device. The
    next parameter is a single-character flag that will be either “l” or “r”, and it is this flag that is used to
    trigger the appropriate callback function on the Arduino.
    The final argument is the integer value sent to the Arduino, which will be a value between 0 and 511.
    Summary
    This is the first of a series of fun things to do with your phone. In the next chapter, we are going to use
    Google’s new ADK technology to create a Geiger counter accessory for our Android phone. Click-click-
    click, RUN!!!!
    www.ECA.ir ﮏﯾﻧورﺗﮑﻟا و قرﺑ ﯽﺻﺻﺧﺗ تﯾﺎﺳ بو
    @ECAir مارﮕﻠﺗ لﺎﻧﺎﮐ رد تﯾوﺿﻋ


    CHAPTER 2
    Android Geiger Counter
    T
    HE
    E
    VIL
    G
    ENIUS’S MINIONS
    are always leaving radioactive material lying around after his failed
    attempts at world domination. Tired of continual accidental exposure to radiation, the Evil Genius
    decided to make a Geiger counter accessory for his Android phone (
    Figure 2-1
    ).
    Figure 2-1 The Android Geiger counter
    Google, developers of the extremely successful Android mobile operating system, chose Arduino as
    the basis for their open accessory development kit (sometimes called ADK). This is a protocol
    specification and library software developed by Google to encourage third parties (that’s us) to develop
    hardware accessories to which an Android device can be docked, via its USB connection.
    While Google probably expected accessories to be boom boxes and other fairly dull living room–
    type accessories, the Evil Genius seized the opportunity to develop some more exciting open accessories
    for his cell phone, such as this Geiger counter.
    The Geiger counter uses a cheap Geiger-Müller (GM) tube sourced on eBay for about USD 20. The
    tube is not sensitive to alpha radiation. Such tubes are more expensive and difficult to obtain, but should
    still work fine with this design.
    The whole project should cost less than USD 100, including the Arduino and USB host shield.
    www.ECA.ir ﮏﯾﻧورﺗﮑﻟا و قرﺑ ﯽﺻﺻﺧﺗ تﯾﺎﺳ بو
    @ECAir مارﮕﻠﺗ لﺎﻧﺎﮐ رد تﯾوﺿﻋ



    Download 22.85 Mb.
    1   ...   10   11   12   13   14   15   16   17   ...   106




    Download 22.85 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Arduino + Android Projects for the Evil Genius

    Download 22.85 Mb.
    Pdf ko'rish