Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PYTHON for programming microcontroller

Status
Not open for further replies.

ucsam

Advanced Member level 4
Joined
Oct 12, 2010
Messages
119
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
kathmandu,nepal
Activity points
2,058
Can we program micro-controllers and micro-controllers' applications with PYTHON? I am getting very interesting to program with python, if u guys have any information just drop it by! :grin:
 

ucsam

Advanced Member level 4
Joined
Oct 12, 2010
Messages
119
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
kathmandu,nepal
Activity points
2,058
what is the advantage of using python over C? or C++ or JAVA?
 

pymcu

Newbie level 1
Joined
Feb 28, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Can we program micro-controllers and micro-controllers' applications with PYTHON? I am getting very interesting to program with python, if u guys have any information just drop it by! :grin:

I've been wanting to do something similar for a long time I couldn't find a decent solution so I came up with something myself: www.pymcu.com
my solution was to make something that would allow for rapid prototyping of new circuits and components so it doesn't run python on the microcontroller itself, you run python on your computer and use the pymcu python module on the computer to control the microcontroller. I put together some various examples and tutorials if you check out the page to get an idea of what you can do with it.
 

kak111

Advanced Member level 4
Joined
Mar 30, 2011
Messages
1,366
Helped
933
Reputation
1,868
Reaction score
907
Trophy points
1,413
Location
Finland
Activity points
10,942

nnm

Junior Member level 3
Joined
Aug 28, 2007
Messages
28
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,438
Nothing to worry about now , It is our time , just visit the site https://www.pymcu.com/

simple than Arduino ,
example :::::
Blink a LED - The electronics version of "Hello World"

import pymcu # Import the pymcu module

mb = pymcu.mcuModule() # Initialize mb (My Board) with mcuModule Class Object - Find first available pymcu hardware module.

for x in range(1,25): # Create a for next loop with 25 iterations
mb.pinHigh(1) # Set D1 pin High (LED On)
mb.pausems(500) # Sleep for half a second
mb.pinLow(1) # Set D1 pin Low (LED Off)
mb.pausems(500) # Sleep for half a second


ARDUINO- Example


/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
 
  • Like
Reactions: yura717

    yura717

    Points: 2
    Helpful Answer Positive Rating

arbj2

Full Member level 3
Joined
Apr 10, 2012
Messages
166
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,298
Activity points
2,697
as we are on the topic of python, I just want to know some more info on python.

These questions are related to Python language on a linux PC.

1. Is python a interpreter based language ?.
2. Can python scripts be turned into executables or binaries for execution on linux ? or will the program be executed as a script.

I would like to develop a python program for a linux system, to release this program for commercial use, can the program be turned into an executable, or do I have to give out the script ? The problem is that I do not want my users to see the script...

thanks
a
 

123jack

Advanced Member level 2
Joined
Apr 21, 2010
Messages
547
Helped
91
Reputation
182
Reaction score
77
Trophy points
1,308
Location
UK
Activity points
5,357
Can we program micro-controllers and micro-controllers' applications with PYTHON? I am getting very interesting to program with python, if u guys have any information just drop it by! :grin:

You are unwittingly trying to make life difficult for yourself I think.
Python is a scripted OOP language written (mostly) in C.
When people say "compiled" python they mean all sorts of things that technically are not compilation at all.
IMHO compilation should always mean down to machine code. Everything else is just interpreting IMO.
(Bytecode is often used but once again thats generally just an interpretive code I would argue.)
But thats just me - others may argue.
It doesnt really make sense to use python on a PIC at all - anymore than using C++ or Java/javascript.
For one thing - the components that constitute a python application just wont fit. Not enough memory
to do oop or use all those libraries. Not to mention stack space.
I expect a subset of python could be used but you would be better off writing a brand new language because
you couldnt call it "python" anymore.
On the other hand if you just want a high level language that's easier to use than C
then PASCAL could do it. Or even Basic is available. You might want to look into using
FORTH if you just want something esoteric (and clever).
Personally I don't see any reason to use anything but C but once again - just my preference
based on what I find most efficient.
 

yura717

Advanced Member level 2
Joined
Aug 24, 2009
Messages
690
Helped
90
Reputation
178
Reaction score
89
Trophy points
1,308
Location
USA
Activity points
4,589
but not on a microcontroler... and for anything else a RAD is faster.
I said Software development 2 faster when you use Python language / than C or C++ /
 

123jack

Advanced Member level 2
Joined
Apr 21, 2010
Messages
547
Helped
91
Reputation
182
Reaction score
77
Trophy points
1,308
Location
UK
Activity points
5,357
If a RAD is faster why would you ever use python if speed is a concern?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top