Embedded Programming
This week we worked with Embedded Programming. All the details of this information are found in Embedded Programming-FabLab Puebla
Arduin code
Arduino is used as a microcontroller, when it has a program downloaded from a computer and works independently of it, and controls and powers certain devices and makes decisions according to the downloaded program and interacts with the physical world thanks to sensors and actuators. After reviewing the information I started working with Arduino, for that it was necessary to make sure that the board was in bootloger mode: press the "B" button, connect the circuit with the USB input and release the button.My goal this week was to learn about Embedded Programming. Some simple codes were loaded.
The first one was "turn on LED".
int estado; // Esta variable es para el boton de encendido void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(D0, OUTPUT); pinMode(D1, INPUT); } //the loop function runs over and over again forever void loop() { //Esta linea guarda el estado del boton estado=digitalRead(D1); if(estado==HIGH) { digitalWrite(D0,HIGH); } NOTE: The code is loaded with the small arrow (second button).
Another code I tried was to make the LED blink:
// Esto es para que el led encienda y apage void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(D6, OUTPUT); } //the loop function runs over and over again forever void loop() { digitalWrite(D6, HIGH); //prende el led delay(1000); // hace que el encendido sea por 1 seg digitalWrite(D6, LOW); // hace que el led se apage delay(1000); // hace que el apagado sea por 1 seg }
Python code
Python is a programming language widely used in web applications, software development, data science, and machine learning (ML). Developers use Python because it is efficient and easy to learn, and it can run on many different platforms. Python software is free to download, integrates well with all types of systems and increases the speed of development.
It was necessary to make sure that the board was in bootloger mode: press the "B" button, connect the circuit with the USB input and release the button. The USB mus change its name.
To open de MU editor
To select mode CircuitPython ("purple snake")
To use the "print" function to verify communication
use the serial window to verify communication and check for code errors
Results
The results in both languages were the same: turn on lesd, use of the button, rainbow colors on the LED
Discussion
Benefits of Python include the following: Developers can easily read and understand Python programs due to its basic English-like syntax. Python allows developers to be more productive as they can write a Python program with fewer lines of code compared to many other languages. Python has a large standard library that contains reusable code for almost any task. This way, developers don't have to write code from scratch. Developers can easily use Python with other popular programming languages, such as Java, C, and C++. The active Python community includes millions of supportive developers around the world. If a problem occurs, you can get quick support from the community. There are many useful resources available on the internet if you want to learn Python. For example, you can easily find videos, tutorials, documentation, and developer guides. Python can be ported across different computer operating systems, such as Windows, macOS, Linux, and U.
Benefits of Arduin include the following: A low cost. For little money you can get an Arduino kit with the necessary components to get started with it. Easy to use. Anyone can use it, even if they have little knowledge of programming, electronics and these environments. At any age, even children. Open platform. It is open source, so a large number of projects and development possibilities can be built. With fewer limits, since it can be combined with other platforms or different functions such as creating drones and more. High flexibility. You can work on all computer platforms, or almost all. It is open source and has many tools to make it easy to use and create great things with it. Great variety of plates, there is not just one plate but a large family that has certain similarities and differences depending on the project you want to carry out with it. It is the ideal way to get into programming, with visual systems such as Scratch. It is much easier to learn to program from scratch, and without writing code. To learn electronics, it is better to start with Arduino. This way you can create and customize lighting systems, robots and much more. You will learn about electronic components and their fundamentals, among many other things. The hardware and software is expandable and open source, you have great possibilities to create projects of all kinds.
Conclusion
I have to explore more of the uses and applications, both represented challenges for me because it was the first time I used both languages. But for now I can say that it was less difficult for me to make the codes in Arduin.