Shop OBEX P1 Docs P2 Docs Learn Events
Open Propeller Project #1: iPad to ActivityBot - Page 2 — Parallax Forums

Open Propeller Project #1: iPad to ActivityBot

2456711

Comments

  • banjobanjo Posts: 443
    edited 2014-01-16 00:42
    Ken Gracey wrote: »
    Thomas, I've got all the hardware to duplicate your setup. All I'm missing is a bit of time - my hands are full at Parallax and I'm not that good of a programmer anyway. However, as this progresses you can count on me jumping into the mix and testing the same hardware setup. So far, you've got the lead on our efforts. Unsoundcode is wandering around somewhere, and I could send him an XBee WiFi unit so he could help us out. I'll try to track him down.

    You mentioned that your router failed. I've pulled out my hair over slow-failing, sloppy-to-configure routers in the past. You're in Finland, so maybe go here https://foursquare.com/v/verkkokauppacom/4adcdb27f964a520cc6121e3 if you are in Helsinki tomorrow morning.

    And with techBASIC developers on the forum I'm thinking they'll jump in and help us troubleshoot, too.

    Ken Gracey

    Thanks Ken for trying to help me even with my router problems! The old router is suddenly alive again after resting overnight, but I'll anyhow get a new one today.
    I believe the old one is suffering of some power issues since the original power adapter broke down last summer.
    Unfortunately I'll probably need to spend a few hours configuring and understanding the new router instead of contributing to this thread.

    -Thomas
  • David BetzDavid Betz Posts: 14,511
    edited 2014-01-16 03:33
    dgately wrote: »
    ITo answer Dave's question: On the Propeller side, the Bluetooth device is just another UART connection. The HMSoft firmware responds to AT+ type commands to set up the UUIDs and modes needed to communicate to a "central" Bluetooth device, such as an iPhone, iPad or Android device. There is so far, very little code on the Propeller side. I send about 8 commands to the device to create an LE server (peripheral). It appears that a method very similar to previous XBee loader methods is needed. Right now, my issue is sending binary data rather than textual data.
    You mention that your Bluetooth module responds to AT commands. Does it also support the Xbee "API mode" where you can send/receive binary frames? I just got a PASM driver working last night that communicates with the Xbee WiFi module using this protocol. I was able to both send and receive frames to the Xbee module. Today I plan to try making TCP/IP connections from a PC.

    You mention "previous Xbee loader methods". Can you point to where these are described? My plan has been to just use a similar technique to what I used in propeller-load for loading XMM images and also in my Propeller 2 loader. This is basically where a COG handles the loading using a minimum of hub memory for buffers. The idea would be to leave almost all of hub memory for the user program.

    Thanks,
    David
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-01-16 06:52
    Ken Gracey wrote: »

    iPads were handed out at my son's public school. Their homework is distributed, collected and assessed using iTunes University. The benefit to him is tremendous - school days are shorter, class time is more productive, and less paper is shuffled around. It's a whole ecosystem around the iPad. I like what I see, and apparently others do as well.

    Would be great if there were an Android version of techBASIC (not sure) as I know this OS is quickly gaining speed on iOS in the general user market (not sure of schools).

    If you want to participate, we'd love to have you! I want to keep the tone and effort as productive as possible.

    Ken Gracey

    Yes, I'm familiar with the iPad/school initiative. I'm a little surprised that "techBASIC" got a pass to be on the iPad. It's a good sign of positive steps on the right direction on Apple's part. I'll be watching this thread to see the developments. I'm curious, is it possible to connect a keyboard to the iPad?

    I'll try to keep my giggling down to a minimum and be amazed at what you guys accomplish using a closed source system to teach openess. :)

    Jeff
  • David BetzDavid Betz Posts: 14,511
    edited 2014-01-16 07:13
    'm curious, is it possible to connect a keyboard to the iPad?
    Apple and other vendors provide Bluetooth keyboards that work with the iPhone and iPad.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2014-01-16 07:13
    I'm curious, is it possible to connect a keyboard to the iPad?

    Jeff

    http://store.apple.com/us/ipad/ipad-accessories/keyboards Students write papers, take notes, and use this in the same way you would as a laptop.

    Ken Gracey
  • tdlivingstdlivings Posts: 437
    edited 2014-01-16 09:05
    @dgately

    Dennis
    Instead of sending binary data send text like in the olden days using Motorola S Records or something
    similar.
    This way you are just using the serial connection you already have to send the text. On the Prop side the
    loader becomes a parser in front of the present Prop loader that can parse the SRec data back to binary.

    This would also require OpenSpin and PropGCC to output SRec's files to be sent wireless.

    Just a suggestion to think about
    http://en.wikipedia.org/wiki/SREC_(file_format)

    Tom
  • banjobanjo Posts: 443
    edited 2014-01-16 12:05
    banjo wrote: »
    Jeff, thanks for the information and new code, learning something new every day. Might be that the WHILE/WEND was sometimes eating too much resources and causing some of the issues I've had.
    I'll try your code hopefully later today if I get a new WLAN ADSL-router (the old died yesterday, got resurrected this morning, but will anyhow be retired)

    -Thomas

    Jeff, tried your code and it is indeed looking nicer.
    I also have a brand new router now, but have still unfortunately from time to time issues.
    Sometimes XBee returns a timeout and sometime the connection between iPad and XBee is disconnected. All traffic is going through the router as I initially was not able to get a direct connection to work. Will however try a direct connection again.

    I'd be interested to know if anyone gets this to work in a stable mode. In post #18 you find my initial setup and in post #25 you find Jeff's revised TechBasic code.

    -Thomas
  • LtechLtech Posts: 366
    edited 2014-01-16 12:18
    Ipad trough usb, usb-hub, usb to network, spinneret, to serial ?

    Ipad ethernet :-)

    http://www.youtube.com/watch?v=sMW_QAgFb-A
  • dgatelydgately Posts: 1,621
    edited 2014-01-16 12:43
    I've opened another thread to discuss the native iPad app to propeller project, in order to keep this thread focused. Thanks for your questions and comments!

    http://forums.parallax.com/showthread.php/153249-iOS-to-Propeller-programming-proof-of-concept


    dgately
  • Brian_BBrian_B Posts: 841
    edited 2014-01-16 16:22
    Hi all,
    I'm just about have all the pieces here to help out ,wifi radio should be here tomorrow from parallax.

    Here is a dumb question ,is there away to type the code for techBasic in a text program on my computer and then import it into the iPad? ,this touch screen typing is driving me up a wall.

    Brian
  • tdlivingstdlivings Posts: 437
    edited 2014-01-16 16:46
    Type it on your PC and email it to the iPad
    Then use copy and paste from the email into Tech Basic.

    This is the method explained in the Tech Basic Manual and is the required method due to
    Apple restrictions on file types that can be directly sent to an iPad

    Tom
  • UnsoundcodeUnsoundcode Posts: 1,530
    edited 2014-01-16 17:07
    Hi Brian, the question about keyboards was raised earlier in the thread as you see its a pain if you don't have one. As Tom says email is an option for transferring files another is to synch your iPad with iTunes, iTunes allows the transfer of files in and out of techBasic's sandbox. Even then you cant transfer program files directly, whichever way you go involves a copy and paste.

    Jeff T.
  • Brian_BBrian_B Posts: 841
    edited 2014-01-16 17:10
    Yeah ,I saw the email thing ,I hoping there was a ;);) way to do it.



    Thanks

    Brian
  • David BetzDavid Betz Posts: 14,511
    edited 2014-01-16 18:52
    FYI, I got my Xbee Wi-Fi loader code to accept a connection from a PC, receive a message, and send a response back to the PC. I guess that's the "Hello, World!" program of networking so I'm go on to implementing the loader functionality now.
  • dgatelydgately Posts: 1,621
    edited 2014-01-16 18:53
    tdlivings wrote: »
    This is the method explained in the Tech Basic Manual and is the required method due to
    Apple restrictions on file types that can be directly sent to an iPad

    It's not that Apple has restrictions on file types. It's that iOS does not have UI methods for file access outside of apps (no Finder or Desktop and no Open/Save dialogs built into the OS). Most apps that handle specific file types can accept files directly from other apps such as the Mail app. If techBASIC is set to handle files with a specific extension (.bas ?), then you should be able to press the attachment box in the Mail message, which brings up an "Open in AppName" chooser, listing all of the apps that can open that file type.

    I'm sending .spin files to my own app, which opens them as well as .zip archives of libraries, with out issue!

    Here's an example of opening an attached .spin file in an email message, with my test app named 'spinTab':

    photo.PNG


    dgately
    640 x 960 - 91K
  • UnsoundcodeUnsoundcode Posts: 1,530
    edited 2014-01-16 19:40
    Thomas sorry your having problems with your connection. I need to get the XBEE wifi so we can work on an adhoc connection initially and eliminate the need for the extra hardware.

    I'm attaching two pieces of code today which are just an expansion of the last source. One is techBasic and one is Spin. The Spin just echoes back what we send and I only used two bytes of a binary transmission. You will also see I used an ASCII character while I looked at the feasibility of some kind of data header.

    It's probably in the manual somewhere but I discovered that a transmitted string is terminated with a newline character decimal 10, there is no programming this newline its just added even on a single ASCII character. Something else that surprised me, and this may be something with the Wifly I don't know, but the characters that were echoed back were transposed and all I can think right now is that the Wifly was delivering data in a last in first out manner. That is something I will look at closer a little later.

    Its only a couple of bytes but could easily be 10 or more. I think when we start sending more data we can try raising the baud rate at the uart. Sorry about the Spin but its easier for me right now the C will come later.
    Comm.openTCPIP(1,url,port)
    
    sensors.setAccelRate(0.01)
    
    DIM quit AS Button
    quit=GraphicsNewButton(10,10)
    quit.setBackGroundColor(1,1,1)
    quit.setGradientColor(0.7,0.7,0.7)
    
    DIM debug AS TextField,echo AS TextField
    debug=Graphics.newTextField(Graphics.width/2,10,100)
    echo=Graphics.newTextField(Graphics.width/2,50,100)
    
    DIM label_1 AS label,label_2 AS label
    label_1=Graphics.newLabel(410,15,80)
    label_2=Graphics.newLabel(410,55,80)
    label_1.setText("TX_Data")
    label_2.setText("RX_Data")
    
    System.ShowGraphics
    
    Sub nullevent(time AS double)
    
    a=sensors.accel
    
    x~ =(a(1)*128)+127
    y~ =(a(2)*128)+127
    
    REM sending accelerator info to Propeller
    print #1,"W"
    put #1,,x~
    put #1,,y~
    REM receiving accelerator echo from Propeller
    get #1,,a~
    get #1,,b~
    
    debug.settext(str(x~) & "   " & str(y~))
    echo.settext(str(a~) & "   " & str(b~))
    
    End Sub
    
    Sub touchUpInside(ctrl AS Button,time AS double)
    
    If ctrl=quit Then
    STOP
    End If
    End Sub
    
    con
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000  
      RX_PIN        =  1
      TX_PIN        =  0
      MODE          = %0000                                 ' see FullDuplexSerial.spin for description
      BAUD          = 9600
        
    obj
      com      : "Extended_FDSerial.spin"
      term     : "Extended_FDSerial.spin"  
    var
      
      Byte buffer[3]
    
      Byte ArrayIn[3]
      
    pub Main  | x , y 
       com.start(TX_PIN,RX_PIN,%0000,BAUD)
       term.start(31,30,%0000,BAUD) 
       com.rxflush
      
         repeat
            
             x:=com.rx                         
             case  x
                "W" : get_data 
                   
     
    Pri get_data  | i                                              
       rxarray(10,@buffer,3)
       i:=1
       repeat 2
           com.tx(buffer[i])
              i ++
                    
    PUB RxArray (ms,stringptr,element_num) : Value | ptr , temp
    
        ptr:=0                            
                                                       
       repeat   while  ptr < element_num 
          temp :=  com.RxTime(ms)    
              if temp == -1
             
                 quit      
           ArrayIn[ptr] :=  temp   
           ptr++
                                            
       byteMove(stringptr,@Arrayin,element_num)
    

    @dgately , hi Dennis, techBasic can import virtually any file extension into it's own sandbox but cannot move source into the programming IDE without copy and paste, apparently they could move it over at one time but for now Apple have restricted it. It would be nice if they got that option back.

    Jeff T.
  • tdlivingstdlivings Posts: 437
    edited 2014-01-16 19:45
    The Tech Basic Manual referring to Apple restrictions is referring to using iTunes to transfer the files.

    They also mention a restriction on the type of file you can put in your App's sandbox and that could
    be why Tech Basic does not use the chooser to open the app by file extension as that might be copying
    a file which Apple considers an executable or even the source text defining an executable.
    Not sure on the last part of source defining the executable but if that was ok why does Tech Basic not use
    your method

    I have an iPad and agree say you click on a pdf link when it downloads you get the option to open it in Adobe Reader
    and if you click on it that downloaded file is copied to Adobe Readers sandbox.

    Only Apple or Tech Basic can answer why .

    Tom
  • tdlivingstdlivings Posts: 437
    edited 2014-01-16 19:54
    Unsound
    Data transposed makes me think Lil and Big Endian issues.
    One micro has the bytes in memory MSB then LSB and the other receiving
    the data from the firs LSB then MSB.
    When sending data from Motorola Micros to a PC i.e. Intel you need to flip
    words and longs around.

    http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/endian.html

    Tom
  • UnsoundcodeUnsoundcode Posts: 1,530
    edited 2014-01-16 20:06
    Thanks Tom, I need to look at it later its not too big an issue. In the mean time here is a current screen shot of the tilt and turn based on banjo's accelerometer code.
    700 x 525 - 27K
  • Br1wr2el3Br1wr2el3 Posts: 13
    edited 2014-01-16 20:58
    I knew I did not have enough to do! I just discovered techBASIC and was beginning to explore it as a tool. My iPad is a second generation so it does not do BLE, but my iPhone does. I needed a reason to upgrade the iPad.

    This sounds like an interesting project and I am amazed by the posts that are already here. I plan to follow along and contribute if reasonable. I will get the XBEE wifi modules ordered and see what I can do.

    Bruce Elliott
  • David BetzDavid Betz Posts: 14,511
    edited 2014-01-16 21:11
    David Betz wrote: »
    FYI, I got my Xbee Wi-Fi loader code to accept a connection from a PC, receive a message, and send a response back to the PC. I guess that's the "Hello, World!" program of networking so I'm go on to implementing the loader functionality now.
    I've discovered something about the Digi Xbee Wi-Fi module. It seems to eat HTTP requests sent to it. I think that's because it defaults to being in "Soft AP" mode which is their name for Wi-Fi Direct. The problem is, there doesn't seem to be any way to turn that mode off. If I begin the first line of any request with POST or GET it is eaten by the Xbee module and never passed on to the Propeller. I wonder if the Sparkfun module that some people are playing with has this same problem?

    Edit: I just checked and Sparkfun is selling the same Digi Xbee Wi-Fi module that I'm already using.
  • dgatelydgately Posts: 1,621
    edited 2014-01-16 21:39
    tdlivings wrote: »
    I have an iPad and agree say you click on a pdf link when it downloads you get the option to open it in Adobe Reader
    and if you click on it that downloaded file is copied to Adobe Readers sandbox.

    Only Apple or Tech Basic can answer why .

    Now you have me worried...

    I was hoping that my app's file import methods would be acceptable.

    Thanks,
    dgately
  • David BetzDavid Betz Posts: 14,511
    edited 2014-01-16 22:03
    David Betz wrote: »
    I've discovered something about the Digi Xbee Wi-Fi module. It seems to eat HTTP requests sent to it. I think that's because it defaults to being in "Soft AP" mode which is their name for Wi-Fi Direct. The problem is, there doesn't seem to be any way to turn that mode off. If I begin the first line of any request with POST or GET it is eaten by the Xbee module and never passed on to the Propeller. I wonder if the Sparkfun module that some people are playing with has this same problem?

    Edit: I just checked and Sparkfun is selling the same Digi Xbee Wi-Fi module that I'm already using.
    Didn't someone here say they were using the WiFly module that Sparkfun sells? It seems to have a better manual than the Digi Wi-Fi module but doesn't have the API mode where you can interact with the module with binary commands rather than ASCII. Costs the same amount as the Digi Wi-Fi module as well and it says it has 128k of RAM.

    Edit: Even though it has 128K of RAM it doesn't look like it is user accessible.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2014-01-16 23:01
    Br1wr2el3 wrote: »
    I knew I did not have enough to do! I just discovered techBASIC and was beginning to explore it as a tool. My iPad is a second generation so it does not do BLE, but my iPhone does. I needed a reason to upgrade the iPad.

    This sounds like an interesting project and I am amazed by the posts that are already here. I plan to follow along and contribute if reasonable. I will get the XBEE wifi modules ordered and see what I can do.

    Bruce Elliott

    Hello Bruce,

    I see this is your first post, so I'd like to welcome you to the Parallax community! I think what you see on this thread is the beginning of something much larger, especially with the capability of some of the contributors. I imagine they'll have achieved this goal pretty soon, and we'll be moving on to bigger projects.

    We look forward to your questions, comments, contributions, or just the desire to follow along in your own way.

    Sincerely,

    Ken Gracey
  • banjobanjo Posts: 443
    edited 2014-01-16 23:27

    It's probably in the manual somewhere but I discovered that a transmitted string is terminated with a newline character decimal 10, there is no programming this newline its just added even on a single ASCII character. Something else that surprised me, and this may be something with the Wifly I don't know, but the characters that were echoed back were transposed and all I can think right now is that the Wifly was delivering data in a last in first out manner. That is something I will look at closer a little later.

    Jeff T.

    This newline character that is sent is good to know about. So far I've only read the part in the manual with AT-commands and just glanced at the other stuff

    -Thomas
  • Heater.Heater. Posts: 21,230
    edited 2014-01-17 01:34
    Ken,

    What on earth is going on here?

    Let me explain:

    First I read about libpropeller a C++ library for the Propeller released under an opensource license. Very interesting.
    http://forums.parallax.com/showthread.php/151022-FYI-libpropeller-MIT-C-library
    Your recent post there, Ken, takes be to the "Parallax Open Propeller Project". Also very interesting. Not so much a project with any focus but a general idea to muster community involvement some how. Given it's name I assume it implies open source software which is generally an essential ingredient in such a venture.

    Eventually I get too "Open Propeller Project #1"
    http://forums.parallax.com/showthread.php/153214-Open-Propeller-Project-1-iPad-to-ActivityBot
    My heart sinks. There is nothing "open" about this project at all.

    1) It requires an iPad. A notoriously closed and locked down computer.
    2) It requies techBasic. A closed source language system that only targets iDevices.
    3) It has the most outrageous requirement that I need an Apple computer before I can even think about working with techBasic or this "open" project.

    Somebody somewhere has totally misunderstood the use of the term "Open" in the modern computing/software landscape.

    Now I'm not saying that "Project #1" isn't going to be a wonderful and useful/educational thing. Or that it should not be supported by Parallax as part of their push into iDevice based educational tools.

    Only that it has no place as an "Open Project" of any kind. Having it up there, especially as as project number one sends out totally the wrong message regarding the understanding of Open.

    My apologies for the little rant here but I do find this baffling. Worse it's a bit of an insult to those who have dedicated their time and effort to real open projects for the Propeller, like GCC, Catalina, Openspin etc etc.
  • banjobanjo Posts: 443
    edited 2014-01-17 03:23
    Heater. wrote: »
    Ken,

    What on earth is going on here?

    Let me explain:

    First I read about libpropeller a C++ library for the Propeller released under an opensource license. Very interesting.
    http://forums.parallax.com/showthread.php/151022-FYI-libpropeller-MIT-C-library
    Your recent post there, Ken, takes be to the "Parallax Open Propeller Project". Also very interesting. Not so much a project with any focus but a general idea to muster community involvement some how. Given it's name I assume it implies open source software which is generally an essential ingredient in such a venture.

    Eventually I get too "Open Propeller Project #1"
    http://forums.parallax.com/showthread.php/153214-Open-Propeller-Project-1-iPad-to-ActivityBot
    My heart sinks. There is nothing "open" about this project at all.

    1) It requires an iPad. A notoriously closed and locked down computer.
    2) It requies techBasic. A closed source language system that only targets iDevices.
    3) It has the most outrageous requirement that I need an Apple computer before I can even think about working with techBasic or this "open" project.

    Somebody somewhere has totally misunderstood the use of the term "Open" in the modern computing/software landscape.

    Now I'm not saying that "Project #1" isn't going to be a wonderful and useful/educational thing. Or that it should not be supported by Parallax as part of their push into iDevice based educational tools.

    Only that it has no place as an "Open Project" of any kind. Having it up there, especially as as project number one sends out totally the wrong message regarding the understanding of Open.

    My apologies for the little rant here but I do find this baffling. Worse it's a bit of an insult to those who have dedicated their time and effort to real open projects for the Propeller, like GCC, Catalina, Openspin etc etc.

    Heater, related to 3) above, then you do not need an Apple computer. I'm one of the early participants but I don't have an Apple computer, just happen to have an iPad & TechBasic from before.
    Otherwise I see your point about the openness.

    -Thomas
  • Heater.Heater. Posts: 21,230
    edited 2014-01-17 03:32
    No iPads around here I'm afraid. As you might have guessed a closed box get's no truck around here. I certainly don't want to spend my time supporting Apple exclusively anyway.
  • Brian_BBrian_B Posts: 841
    edited 2014-01-17 06:58
    Heater,
    I'm not a very big fan of Apple ,but I have kids that love their stuff.

    Ken has always been about education, and If he can find away to make these overpriced toys educate my kids, I'm all for it.

    I've seen what the man can do and I'm excited to see what the big picture is.


    Brian
  • Heater.Heater. Posts: 21,230
    edited 2014-01-17 07:44
    Brian_B,

    I don't mean to belittle the project as such or Parallax's role in education.

    I do question the "Open Propeller Project" idea when it turns out there is nothing open about it's first project.

    My first expectation would have been that something called "Open Propeller Project" as an umbrella project would launch with a big splash about propgcc, SimpleIDE, openspin and a bunch of other open source tools that people have been sweating over for months and years now.
Sign In or Register to comment.