Programming with hardware in python [closed]

2019-01-30 20:23发布

I am starting to get a bit bored of programming little toys that I have been making recently, and I would love to starting programming and interacting with hardware.

The only problem is that I am mostly a python guy who hasn't really learned or used any other language. Can I still interact with hardware with python?

Also, what hardware can I interact with? I don't really have stuff lying around that I can use, so I would have to buy a kit or something. What are some cheap options for this?

9条回答
对你真心纯属浪费
2楼-- · 2019-01-30 20:49

Interacting with the serial port on a PC is fairly trivial and there is Python Serial library available. The roomba robot is controllable via a serial port. There are probably other robots out there, but this might be a simple, smallish step to get you going.

Personally, I learned a lot by buying a PIC programmer and making some simple circuits to flash LEDs. I moved on to controlling those PICs via serial port and later using USB (via libusb). There's a bigger learning curve there as you'll have to program the PICs in C or assembler but you can achieve some pretty incredible results once you've picked up the basics. I warn you though, it's a slippery slope once you realise how many cool little gadgets you can build :-)

查看更多
贼婆χ
3楼-- · 2019-01-30 20:49

The SNAP wireless nodes at www.synapse-wireless.com run a subset of Python called SNAPpy. You can use the peek() and poke() built-ins in the SNAPpy language to interact directly with hardware inside the chip (PWM for example). SNAPpy also has built-ins for I2C, SPI, and serial, so you can control external hardware. It also has built-ins for lower level I/O too, like readPin() writePin() and readAdc(). Something like an EK2500 kit might be good to start with. See also the online user forum at forums.synapse-wireless.com

查看更多
Ridiculous、
4楼-- · 2019-01-30 20:50

Definitely look at Arduino.

  • The hardware design is open-source so you could even assemble your own if you wanted
  • The board includes digital and analog inputs and outputs so it's easy to get some LEDs flashing quickly
  • You program it in a 'language' called Wiring which hides a lot of complexities of C which is usually used on PICs

On the PC side, you could then use pySerial to communicate with the board over USB as mentioned above

查看更多
来,给爷笑一个
5楼-- · 2019-01-30 20:53

I'm not too sure anyone has mentioned the BASIC stamp. Again - it is very limited, but its SUPER simple to start working with. There are some other processors up there they make too, but as an introductory - I think its a great device.

Arduino too is a good one, and you can probably get more bang for you buck with that device.

As mentioned above, I got my start on PIC processors - which are not the easiest thing to work with initially (or really ever... haha - its debateable), but I got a great understanding of how things work in the world of micro controller / hardware interaction.

Best of luck & if you have any questions, feel free to ask away!

查看更多
甜甜的少女心
6楼-- · 2019-01-30 20:58

Buy a Lego Mindstorm kit. The programming language is easy to live with -- it isn't Python -- but it's close enough. And they're real robots with real actuators and sensors.

查看更多
Explosion°爆炸
7楼-- · 2019-01-30 21:05
登录 后发表回答