What's the smallest device I can program on? - mobile

I'm thinking of something smaller than a laptop that i can spend my hours on the way to work doing project euler problems or such.
Any ideas?

If you mean a programming platform, you could get a netbook like the ASUS EEE.
Or if you meant smallest programmable device, check out a PIC microcontroller:
http://en.wikipedia.org/wiki/PIC_microcontroller

This may sound crazy but try pen/pencil and paper. No you can't run the code but it'll help you to not use online references so much (yes they are good but memory skills help us all) and it'll probably also help you plan your code better.

I've programmed directly on my HP 48G series calculator.
There's a good programming tutorial for it here. I'll have to dust it off and see if it will pass Project Euler's one-minute rule.

If you are looking for a microcontroller or similar my advice to you would be to check out either an AVR, PIC, Arduino, or BeagleBoard.
All are relatively cheap and easy to program (the first three more so). AVR's and PIC's are types of microcontrollers that you can program with C or ASM, however you will need some type of prototyping board or similar to achieve anything. An Arduino is an AVR chip sitting on a board, so it is much easier to achieve something in a small amount of time. In addition to this they are quite popular and you can find many projects that have been done at Hackaday. Lastly BeagleBoard is a much gruntier board that will run embedded linux.
My recommendation is for the Arduino.
There are many more suggestions here.
However, If you are looking for a small laptop device to program you have plenty of options. An Asus EEE pc, HP 2133 (I believe thats the correct model), MSI Wind, MacBook Air etc etc. As other people have suggested check out some netbooks. There are also various PDA's or mobile phones that you could program, such as an Android phone or an OpenMoko phone. There are plenty of options, I suggest you find out what size you are looking for specifically and that will narrow down your choices.
Good Luck.

I'll take the reputation hit to say this: why not read a book or watch the scenery go by? Trying to cram more programming into your day isn't actually good for you, and may even make you less productive.

I have used SmallBASIC on my Palm OS 5 device for a while now, and it seems to work well with most of the problems I throw at it.

How about using a Palm with the OnboardC compiler?

A netbook would be ideal.
A graphing calculator might be too limited for programming.

If you're talking about doing a microcontroller, there are several models of arduino boards that are very easy for someone not familiar with embedded programming.

I have a Nokia E51 with python interpreter. It's not pleasant to type with a numeric keypad at all. I think it is as small as you can get.

I have a Samsung i760 running Windows Mobile 6. The slide-out keyboard is fantastic (best mini-keyboard on any device) - I can type on it almost as fast as a normal keyboard. I mainly use it to write Oracle Lite queries in mSQL, which is borderline unusable with any other PDA keyboard.
This question led me to wonder about real programming environments for this device, so I asked another question, and one of the answers was a link to this, which is a Windows Mobile IDE for creating .NET Windows Mobile applications. You write them in C#, even.

Netbooks are smaller than your typical laptop and have plenty of power.

It's pretty subjective. I code on my commute using a 15.4" laptop and I find it quite limiting.
I could still work at 13", but the limitations would be getting so large I'd already be questioning if it's worth it. Anything smaller would be right out.
But then I tend to work with lots of windows open. Multiple editors, docs, browsers etc. Cutting back on that eats into my productivity. At home I have a 30" display. At work I have 2x 24" displays.
If you tend to work mostly in one window, rarely consult docs and other apps etc, you could probably go smaller.
It depends so much on the type of person you are, what you are comfortable with, the way you work, what you are working in and with... the list goes on.
My guess is that for most developers 13" is going to be the smallest before it gets so frustrating that you're better off just listening to podcasts or something - but YMMV - and will!

Related

Creating a touch screen driver for OS X: where to start?

OK, so I recently purchased an Acer T232HL touch screen display to hook up to my Macbook Pro as a secondary monitor. To give you an idea, here's my setup.
OS X doesn't support this monitor in any way, so as you can see in the screenshot I'm actually running Windows 8 through VMware, which proxies the USB connection to Windows perfectly where the touch events are supported. But obviously this isn't ideal.
There's at least one 3rd party driver for OS X that looked sort of promising, but it doesn't seem to support multitouch from this device, it's expensive, and generally was a pain to get working to the small degree it was. There's also mt4j but best I could tell after running their examples, it doesn't support this device at all.
So here's my question: what exactly am I in for if I wanted to write a driver for this thing? I'm mostly a web developer with years of experience with Ruby, Objective-C (and a little C), Javascript, etc. I have never ventured into any kind of hardware programming, so from the surface this feels like an interesting while intimidating challenge.
I know at some level I need to read data from USB. I know this will probably mean trying to reverse engineer whatever protocol they're using for the touch events (is it possible this will be entirely custom?). However I haven't got a clue where to start - would this be a kernel extension? In C, I presume? Would love a high level overview of the moving parts involved here.
Ultimately I want to use the touch screen to drive a specialized web interface (running in Chrome), so ideally I could proxy the touch events straight to Chrome without the OS actually moving the mouse cursor to the touch location (so have the UI behave just as it would on an iPad), but regardless of whether this is technically possible, I'd love to start with just getting something working.
You're going to want to start with Apple's I/O Kit documentation. You can hope that the touchscreen isn't completely custom, though there must be some part that's not standard USB HID, or it would work already. If there are any linux (or other open source) drivers available, you'll have the advantage that somebody already did some of the reverse engineering for you. As an alternative to the I/O Kit, you might also want to look into libusb, which might make your brain hurt less when getting started. If you end up needing to write a kext, that might not help you anymore, though.
As to some of your specific questions:
would this be a kernel extension?
Maybe, maybe not. I'm not really up on the Mac OS X driver situation, but I did write some totally user-space USB code for OS X many years ago. Maybe you'll be as lucky.
In C, I presume?
Probably. I/O Kit itself is written in a subset of C++, so you can probably use that too, if you prefer.
is it possible this will be entirely custom?
Unfortunately, yes, it's possible.
Good luck!

Developing IN an iPod touch

I am thinking about buying an iPod touch and I Wonder if there is Java and c++ editor to install in the iPod, something like having netbeans in the IPod. I want this because I would like to advance in my home-works on my way college-home while I'm on the bus or waiting for someone, etc. Is there anything?
Don't even consider trying to write code on an iPod, or even an iPad.
iPod is the wrong type of device for any sort of development. There are some ergonomic factors which are really important when it comes to writing code:
You should have a decent keyboard - i-devices only have touch-screens. A laptop keyboard is OK but not great.
You need the screen at a reasonable height and angle if you're going to be looking at it for a long time. You need to be able to type with both hands at the same time.
You need as much screen space as you can get.
I could come up with a lot more reasons for not using an i-device for development, but I think they are too obvious to bother listing.
If you really want to do your homework on the bus, you are better off getting yourself a decent laptop.
The iTunes App Store restrictions explicitly prohibit any compilers or interpreters from running on approved iOS apps.
That said, you could make a simple Javascript interpreter in a webpage, and then save it for offline use, without much trouble.
For that matter, any language that's implemented in Javascript and can work in an offline webpage could be used. For example, if you had a compiler written in Javascript, which compiled C++ to Javascript, then you could use that to write C++ on your iPod. I do not know of any such compilers offhand, but there's no theoretical reason they couldn't exist, as the App Store restrictions don't apply to HTML pages you browse to yourself.
A far more practical solution would be to just get a text editor (of which the App Store has many). Write your code on the bus, and then compile it when you get home. It will still be faster than the compilers we had when I was a kid!
(Or just get an SRS and spend the time studying rather than programming, since you're not going to be very effective at programming on a small touchscreen device, anyway.)
There's always an option to jailbreak your device and install GCC toolchain: iphone-gcc in Cydia and instruction here. Netbook would be a much better option though.
You can do some basic HTML and Latex but no Java or C++.
But I found something that could be interesting:
Processing is quite like Java and can be programmed on this site, with every iDevice.
http://jepstone.net/HiperPad/editor.php/HiPad4d113f1595b4c#home

practicing C over the summer

I'm a student with a bit of experience in Java and C++ (one semester each)
Currently, I'm going through K&R and working on the exercises in the book. However, I was thinking of what I could work on over the summer since I'm almost done with K&R and I will have a lot of free time soon.
I really like building command line applications so I was thinking of getting involved with the coreutils project somehow. My question is, is it too early for me to be messing with coreutils? Should I be working on something a bit simpler perhaps? I'm a bit new with the Linux/Open source world if that matters but I'm really enjoying it.
I've done some project euler problems and I don't really like it that much.
Download the Nethack sources. Play it. If you ever get past that stage, then add some new and interesting monsters, weapons, traps and other objects.
https://openhatch.org/search/
http://sourceforge.net/people/
http://www.fsf.org/campaigns/priority-projects/
http://savannah.gnu.org/people/?type_id=1
You can do various other things with C:
Use various data structures like Link-list, tree, hash, heap
Try coding various algorithm implementation
Play with various string manipulation
Work with basic system and socket programing
List goes on..
There are (I'd argue) probably only a couple of places where C is still used extensively in preference to C++, so if you want to make a difference in the Open Source world I'd recommend thinking about working in one of the following areas:
Device drivers, and indeed most aspects of OS kernels.
Interfaces to scripting languages (Python, Perl, Lua etc.)
In both cases, C++ has no significant advantage, or some significant disadvantages, over C.
I agree absolutely with Mark's comment above that it is difficult to join a mature project. I have recently been trying to get a Haskell binding put together for SWIG, and it has proven to be pretty tricky - and I say that with over 20 years of C and about 15 of C++ behind me!
The problem is that mature codebases usually are not so clean, and this means that it can be difficult to understand how things hang together.
If you have the case, working on ARM device such as a Pandora or one of the other small embedded devices you can pick up is a lot of fun, and will teach quite a bit. In many cases what you are looking for is a device with a 'community' Linux port, and for many of these there are some quite basic components which are not yet working.
Good luck, and have fun!
I agree with Jeremy O'Donoghue's answer (since I am also a Mobile Device developer). Go install a 32-bit linux distro (if you don't already have), and start hacking Android Source Code.
There are many mailing-lists dedicated for the Android and you might try discuss some idea from there.
And there is also Google Summer of Code if you can make it

How to create real-life robots?

Even before I learnt programming I've been fascinated with how robots could work. Now I know how the underlying programming instructions would be written, but what I don't understand is how those intructions are followed by the robot.
For example, if I wrote this code:
object=Robot.ScanSurroundings(300,400);
if (Objects.isEatable(object))
{
Robot.moveLeftArm(300,400);
Robot.pickObject(object);
}
How would this program be followed by the CPU in a way that would make the robot do the physical action of looking to the left, moving his arm, and such? Is it done primarily in binary language/ASM?
Lastly, where would i go if I wanted to learn how to create a robot?
In the end, something has to break down the high level commands into very low level commands. Something has to translate "Pick up the cup" to how to move the arm (what angles the joints should be at) to the hardware commands which actually turn the motors.
There are frameworks which try to provide some amount of this translation, including (but not limited to):
Player/Stage
Microsoft Robotics Studio
Carmen
CLARAty
Lego Mindstorms
However, since robotics research is interested in every layer of the system, there aren't many systems which provide the entire translation stack. If you're looking into getting into robotics, there are several systems which attempt to make this easier (again, a random sample):
Lego Mindstorms
TeRK
VEX Robotics
Failing that, sites such as Make even provide guides to building robot projects to start from. The challenge is find a project which you are excited about, and go to town!
You should check out Microsoft Robotics Studio (MRS). They have many videos/screencasts, and written tutorials. Additionally, Channel9 has many videos, interviews, etc, on the robitics subject. Including demonstrations, and interviews with developers of MRS.
In most modern robots you would have an Inverse Kinematic model of the mechanism, in this case the arm, that converts the spatial coordinates into positions for the joints of the arm. These joints are usually moved by servo motors. To smoothly move the arm, you need a series of intermediate joint positions defining the path you want the arm to follow. You also have to worry about the velocities of the joints, which together control the speed of the "hand" at the end of the arm.
While the arm is moving your servo system will be getting feedback about its actual position. Simple servo systems may use a basic PID feedback loop to adjust the motors. More complex systems will include feed-forward parameters which compensate for inertia, gravity, friction, and so on. These can become very sophisticated.
The real fun starts when you have to allow for obstacles in the space around the robot. You have to sense the obstacle and figure out how to avoid it and still reach the destination.
I just have to add something about Arduino projects to this because I dont see it mentioned above.
There is a very low bar for entry into the Arduino based robotics projects. The "sketch" programs that you write for the hardware are very easy to pick up and similar to C syntax. If you dont know your transistors from resistors these boards still allow you to do alot with plug-in hardware and additional "shields" that extend the base computer board.
Its very fun, very flexible and something to get your code interacting with the real world. Plus its "Open Hardware" very along the lines of open source software.
Robots will work by interacting with hardware. The bridge from your code is often done through different type of I/O ports. It could simply be a RS232 cable for example (you know those old COM1 ports). Hardware parts will be composed by motors (such as servo motors) and sensors (such as ultrasound to feel obstacles, lasers to get distance or switches).
You don't need to use assembler to do that, there are lots of languages (if not most) that can do it but it requires knowledge on how to interact with hardware. Like writing a driver. It requires at least basic electronics also if you want to build the robot yourself.
If you're interested, I suggest you have a look at this book which is a good primer.
Also, you could try out programming a Basic stamp, it's pretty easy following the tutorials and it will give you a good start on how to build robots. It's not too expensive and you'll be interacting with hardware in no time.
Good luck and have fun!
If you get good enough at programming, you may discover that you don't even actually need a robot to test much of the hardest code you'll need to write... (IE, making a robot see and recognize a scene always fascinated me... But at some point, I realized that the physical robot required for this problem is the easy part... The software is the hard part!)...
Is probably easier to get a more high-level language to describe the robot's behaviors and intelligence and let the low level language to the actions (move arm, walk, stop). There is a lot of research in what is called BDI architecture for intelligent agents, google for it.
You can find more about at this site, it's a DSL for describing agent behavior made in Java. It's called Jason interpreter and the language is AgentSpeak(L).
Find a local FIRST robotics team and volunteer to be a mentor. FIRST is a robotics competition for middle and high school kids. The goal is that the kids do all of the work to build, program, test, and run the robot, but you still will have lots of opportunities to dig in and really learn the software. They are using LabView by National Instruments, and, as of Feb 8, have just begun regional competition for this year. LabView is a graphical programming environment that interfaces with NI hardware to let you program motors, actuators, and sensors. The NI stuff is pretty slick and is pretty easy to use, plus it's provided free to each team, so you don't have to buy the hardware and software yourself (at least to get started.) Plus, you get the added bonus of helping a new generation of engineers get their start.
You would have to have a driver that interfaced with the hardware (most likely a STAMP or FPGA with motors etc...). You would then call the function me.moveLeftArm(x,y); and the driver would know that moveLeftArm() means to move an actuator for X seconds/milliseconds/degrees.
I'm sure that you could find a kit that does robot programming.
If you want a Java alternative, I can recommend the book Linux Robotics. It has a lot of good information about where to get kits, parts, and sensors, as well as complete source code listings in Java.
I share the same itch .. I'm about to buy my first Beagle Board and some sensors / servos that can use the I2C bus. I'm going to be using an event driven design and a crude implementation of fibers (fibrils, if you will) which are userspace threads.
Basically my design calls for one process, which launches one thread per group of servos. Each group manager thread will launch x # of fibrils, 2 per servo (likely). One fibril is used to control the servo, the other fibril handles events from that servo (i.e., an object is just too heavy to pick up, an object was dropped, etc).
The main process has the task of listening for events from everything else and making sure the 'right hand knows what the left hand is doing' while moving forward and negotiating obstacles.
Its going to take me the better part of two years to get something working to the point that I'm proud of it .. but I anticipate many enjoyable evenings getting it to that point.
I will very likely be using a Microkernel, not Linux.
I'm doing this as much to sharpen myself with event driven methods as well as my desire to make my own R2 :)
Start with Phidets if you are familiar with .Net. You can checkout TrossenRobotics.com for parts.
The Phidgets interface kit is a good place to start. From there you can get a servo controller and start building things that move.
The Trossen forums are also a good place to review other people's projects. They have a new Data Center with code/project samples too. I don't work for them...just a happy customer.
lots of good answers here. your piece of fantasy code is not far from how you'd do in a higher level language such as C# over MS Robotics Studio. Just keep in mind that even simple things (like "move arm left") are very loaded with "information bias".
down to the metal, a robotic arm is a set of links and [possibly] motorized joints. Therefore "move arm left" (or any point in coordinate) is already a very complex task to compute (look for D&H Table, forward and inverse kinematics for manipulators).
There's also the concept that move arm left assumes there's nothing in that space and a collision won't occur. If the environment is unconstrained, then you need to implement a collision detection system, often based on some sort of sensor (camera) and machine vision algorithms.
In summary, the language and the hardware interfacing are often trivial compared to modeling the system to achieve the desired behavior.
Regarding the last question "how to create a robot", I find starting from looking for a related project in online communities like [Adafruit][1], [Hackster.io][2], or even [glitch][3], or looking for blog posts of someone who have built a robot from scratch, e.g., https://burningservos.com, or a product that provides documentations & tutorials for both hardware and software e.g., http://emanual.robotis.com/docs/en/platform/openmanipulator_x/overview/.

Programming on a Nintendo DS

I was reading this answer previously and it got me interested in purchasing a Nintendo DS Lite for learning to program embedded devices. Before I go out and splurge on a DS I had a few questions:
Are there any restrictions on what you can program? The post I indicated earlier seemed to say there weren't, but clarification would be nice.
Would I be better off buying an arduino (or similar) and going that route? I like the DS because it already has a lot of hardware built in.
I'm thinking of getting a CycloDS Evo card, is there a better option for homebrew?
What are the best resources to learn about DS development?
Thanks for your time, If you have a DS and program on it, I'd love you hear your opinion, or alternatively if you have a better idea, I'd like to hear it too.
Thanks =]
No, there really isn't much of a
limitation beyond that of the
hardware, and even that can be
overcome with enough effort. Quake
has been ported to DS, for example,
and particle games that utilize both
processors have been made. There
has also been discussion on how to
make higher quality 3D scenes using
a double pass renderer. There are
multiple resources on the Nintendo
DS section of the GBADev
forums.
I
would say that the DS is an
excellent route to embedded systems
development; there is a large and
active community that is willing to
answer questions and give support,
and there is so much hardware built
straight into the thing. It saves
you the time of building a system to
test on.
The CycloDS Evolution is a
good card and is fairly common, so
it shouldn't be difficult - if
necessary at all - to make your homebrew compatable with
other cards. However, be aware that
other popular choices are the M3
line and the R4 line, which are
pretty much the same thing. I have
a TTDS, and it works well, but not
out of the box. I would reccommend
the other three mentioned.
As for
beginning DS devving, I would
reccommend looking at the basic
examples found in the examples folder of devkitPro and reading the GBA
tutorial
TONC,
which covers many of the concepts
that are used in both GBA and DS
development. A more DS oriented
tutorial, Patater's
Introduction to Nintendo DS
Programming,
will help beginners get on their way
in the DS world. There is also a very comprehensive documentation
spec for the GBA and DS known as
GBATek.
I've done a little programming on the DS Lite about 1 year ago. The major hardware limitation that I had was working with the WiFi hardware. I found that DS-DS communication was not possible with the homebrew libraries at the time. I am not sure if that has changed. I also found that you could not form an Ad-Hoc connection to another device. I had to connect to an 802.11b network in infrastructure mode and the SSID had to be broadcast.
For developing I used
PALib (helper libraries): http://www.palib.info/wiki/doku.php?id=day1
DevKitPro (toolchain): http://www.devkitpro.org/
no$gba (DS Emulator) - http://nocash.emubase.de/gba.htm
Supercard Lite (hardware to run homebrew applications) - http://www.realhotstuff.com/-c-32_81.html
I don't recommend the Supercard Lite as it required use of the GBA and DS slot of the DS. At the time this was the only option. There are now DS slot only solutions such as the R4. I have a friend who is using the R4 and has pretty good success with it, though I have not used it myself.
I haven't done any programming on the DS, but I have done some development on the GBA (Game Boy Advanced). If what you're looking to do is learn how to program embedded devices, that might be a good option for you (and certainly a cheaper one). There's even a free book you can get online: Programming the Nintendo Gameboy Advanced. I suggest the GBA because, as I've seen, there are a lot more resources online for learning how to program for it. One drawback is that it doesn't have wifi, which means you won't be able to do as many cool things as you would for the DS, but it's certainly a start!
Can't say anything about 1,2, or 3. but the resource I use for GBA programming also has DS info:
http://nocash.emubase.de/gbatek.htm (and this is a deep down technical spec document, but I like it for that)
Also: http://www.devkitpro.org/ for the compilers and stuff.
The restrictions are hardware restrictions - there's 4Mb of RAM, the 3D hardware can handle X polys per frame and so on. Aside from that, it's just a bunch of hardware that you can do what you want with. The toolchain supports C/C++ and assembler (ARM).
The variety of hardware is why I like it too. Getting to grips with each piece of the puzzle is what makes the DS a fun - each bit of hardware has it's own set of tricks for getting the most out of it.
Don't have one myself, so I guess just check here. Looks nice though. Edit: The only nit I would pick with it is that you'll be swapping the SD card between PC and NDS a lot, whereas a cart with an onboard USB socket would give you slightly faster turnaround.
The best resources are the libnds examples, and then the gbadev forums.
I just got a CycloDS Evolution the other day, and I am loving it! DSOrganize is like a mini-OS which adds a bunch of stuff I was wishing the DS came with, like an actual calendar app!
To address Mike F's #3, there is actually an FTP server for DS, which you can use to transfer files to your DS wirelessly. I haven't tried it myself though, since my network uses WPA and the DS only seems to support WEP.
Honestly, I found the Nintendo DS and the homebrew community while I was attending an Embedded Systems course in college, and I realized the similarities between the ATmega32-based kit I was programming for the class and the hardware-level development of the Nintendo DS via libnds, and I was hooked.
Personally, I've come from a strong C++ background, but being able to walk around with something in my pocket that I've programmed has been a goal of mine since I first got my hands on a TI-83 Plus calculator... I'm now able to realize that goal due to the Nintendo DS.
Anyway, I hope you have as much fun getting into DS development as I have over the past months, and I wish you luck on your endeavors.
I have done both, more GBA than DS. I would recommend GBA first then moving up to DS because it doubles the complication. The ezflash V gba sized 3 in 1 is a good card. I have a bootloader for the gba that I wrote to the card using an NDS and a program that I downloaded that I cant remember the name of off hand. Once the bootloader was working a serial cable and lets me debug programs as well as load them into ram. that card also allows you to load into ram on the card and run from there taking advantage of the prefetch buffer and a bigger program. For the NDS I have tried many of the cards. The cyclods is good for day to day use, but for development not so much. I think I liked the Acekard 2 better, or the R4. think about the number of times you pull the card out and pull the sd card out and load it into a computer. Very painful you want a card with an sd card slot you can get at without having to pull the slot0 card out. the cyclods is not it. A very good card though for the NDS. I dont think it works on the NDSi where the acekard 2 does. For both nds and gba you can get your feet wet with simulators like visualboyadvance, they are not completely accurate and very common that programs that work on the simulator will not work on real hardware, programs that work on real hardware will usually work on the simulator though. removing the development card, reprogramming, and replacing is very painful, bootloaders, wifi, or any other way you can avoid that is well worth it.
Arduinos are fun and interesting, the lilypad and the usb to serial thing is the one I recommend, no soldering required and you can start using for not a big investment. I like the armmite pro better, arduino like footprint but arm based (the only lpc I would buy, not an lpc fan right now). And you dont need to buy the serial thing, just a normal usb cable and a jumper (well maybe a paper clip until you solder on a jumper). I just ordered two more and so far my code that erased the as-shipped flash and allowed me to load whatever I want isnt working, gotta go figure that out. I continue to be very pleased with the olimex sam7-h64 and h256 (header board at91sam7s256), as with the avr atmel is very developer friendly with good docs. Sparkfun is a good place to find all of the above in the USA. Sam-ba now has a linux version if you use linux as I do, the windows version had been there for a while, fairly easy to erase and reprogram, much easier than a ds or gba, on par with the arduino or armmite pro or similar.
Formerly luminary micro now ti stellaris has some good boards. like the gba/nds but unlike the other boards I mentioned there are displays and other peripherals to play with, usb is all you need to program. thumb mode only though. GBA prefers thumb mode for performance but can go either way. nds, I dont remember, never got so far as to understand the width of the busses and their timing. Knowing Nintendo and their cheapness thumb is probably better/faster. the lm3s811 eval board was too easy to brick, the 1968 is not a bad one. I dont like that they were pushing developers away from the source and into pre-built libraries tailored to the rtos and specific compiler suite.

Resources