├── README.md ├── doc-en ├── Bio-Robotics-en.md ├── CPU-or-GPU.md ├── Hibrido-AI-bot.md ├── Hibrido-ai.bots.md ├── Hibrido.md ├── Linguagem-Alentejo.md ├── README.md ├── hardware-programming-1.md └── hardware-programming.md └── doc-pt ├── Bio-Robotica.md ├── CPU-or-GPU.md ├── Hibrido-AI-bot.md ├── Hibrido-ai.bots.md ├── Hibrido.md ├── Linguagem-Alentejo.md ├── Multiplos-Bots-Robots.md ├── Programacao-por-Hardware-1.md └── programação-por-hardware.md /README.md: -------------------------------------------------------------------------------- 1 | - [English](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README-en.md) 2 | - [translator google](https://github.com/0joseDark/traslator-google-English-Portuguese) 3 | # ideia futura, fazer minha linguagem de programação 4 | - [programação por hardware](https://github.com/0joseDark/my-programming-language/blob/main/doc-pt/programa%C3%A7%C3%A3o-por-hardware.md), [exemplo 1](https://github.com/0joseDark/my-programming-language/blob/main/doc-pt/Programacao-por-Hardware-1.md) 5 | 6 | - um conceito antigo, mas atual 7 | - fazer seres vivos, [Bio-Robótica](https://github.com/0joseDark/my-programming-language/blob/main/doc-pt/Bio-Robotica.md) 8 | - respeitar os outros seres vivos 9 | - nome: __Alentejo__ 10 | ## Simplificando 11 | - A base do [Alentejo](https://github.com/0joseDark/my-programming-language/blob/main/doc-pt/Linguagem-Alentejo.md) é o **português**. 12 | ### Alentejo = 13 | - Código de máquina (`ficheiros .bin`) 14 | - Assembler (`ficheiros .asm`) 15 | - Python 16 | - HTML 17 | - JavaScript 18 | - CSS 19 | - SQLite ou MySQL 20 | - C ou C++ 21 | - Português ou Inglês 22 | --- 23 | - complicando, adicione o opensim, o simulador 3D com física 24 | 25 | - - explorando modulos para a nave ou starship 26 | - estudando as regras para a linguagem __Alentejo__ 27 | --- 28 | # Comunicação com Seres Vivos e Máquinas 29 | 30 | Eu consigo **ler**, **escutar** e **falar** com seres vivos e com máquinas. 31 | Mas atenção: **não sou um ciborgue**, __sou humano__ mesmo 😄. 32 | 33 | Atualmente, estou a **praticar o gatez, a língua de gato**. *lol* 34 | Com as máquinas, é praticamente a mesma coisa: 35 | **estudar a linguagem maquina**! 36 | **[CPU ou GPU](https://github.com/0joseDark/my-programming-language/blob/main/doc-pt/CPU-or-GPU.md)** 37 | Gosto bastante dos **CPUs AMD** e das **GPUs NVIDIA**. 38 | Vou aprofundar o estudo dum **CPU AMD** e usar o **CUDA** para tirar proveito da **GPU NVIDIA**. 39 | 40 | Isso vai permitir-me criar e treinar uma **rede neural**. 41 | 42 | -------------------------------------------------------------------------------- /doc-en/Bio-Robotics-en.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | ### What is Bio-Robotics? 3 | **Bio-Robotics** is an interdisciplinary field that combines biology, robotics, and engineering to develop devices and systems inspired by biology. These systems may include: 4 | 5 | - **Prostheses and Exoskeletons**: Robotic devices that help people with physical disabilities regain movement. 6 | - **Bio-Inspired Robots**: Machines that mimic animals or living organisms to improve mobility, efficiency, or environmental adaptation. 7 | - **Brain-Machine Interfaces (BMI)**: Technologies that connect the human brain to electronic devices for direct control. 8 | - **Biomedical Nanorobots**: Small robots designed to operate inside the human body, assisting in medical treatments such as drug delivery and tissue repair. 9 | 10 | Bio-robotics has applications in medicine, industry, and space exploration, helping to improve quality of life and expand human capabilities. 11 | 12 | --- 13 | 14 | ### Is it possible to rewrite DNA? 15 | Yes, **DNA editing** is a reality thanks to technologies like **CRISPR-Cas9**, which allows genetic sequences to be modified with high precision. This process can be used to: 16 | 17 | - **Correct genetic mutations** responsible for hereditary diseases. 18 | - **Create genetically modified organisms (GMOs)**, such as pest-resistant plants. 19 | - **Produce personalized gene therapies** to treat diseases like cancer. 20 | 21 | Despite its potential, genetic editing raises ethical and safety concerns, especially when it comes to modifying human embryos. Therefore, regulations in this field are still under development. 22 | -------------------------------------------------------------------------------- /doc-en/CPU-or-GPU.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | ## Which is Better? **CPU** or **GPU**? 3 | 4 | There’s no single answer, 5 | just like there’s no one hoe for all soils. 6 | It depends on what you want to cultivate, 7 | and how you want to split the work. 8 | 9 | ### CPU: The Jack-of-All-Trades 10 | 11 | The **CPU** is like a wise old man: 12 | does everything, calmly and precisely. 13 | Ideal for **complex tasks**, 14 | with lots of decisions, 15 | lots of logic, 16 | and paths that change at every step. 17 | 18 | - Great for **control**, **sequencing**, **interpretation**. 19 | - Few cores, but **very versatile**. 20 | - Excellent at solving problems **one at a time**, but with intelligence. 21 | 22 | > “When the job requires brainwork, you call the CPU.” 23 | 24 | --- 25 | 26 | ### GPU: The Mass Worker 27 | 28 | The **GPU** is like a battalion of workers: 29 | a thousand arms doing the same task with brute force. 30 | 31 | Made for **parallel tasks**, 32 | like **image processing**, **neural networks**, 33 | or **large-scale simulations**. 34 | 35 | - Hundreds or thousands of simple cores. 36 | - A specialist at doing **many identical things** at once. 37 | - Ideal for **splitting identical tasks**, without complications. 38 | 39 | > “When the job requires numbers and repetition, you call the GPU.” 40 | 41 | --- 42 | 43 | ### So... Which is Better for Splitting Tasks? 44 | 45 | It depends: 46 | 47 | - **Varied tasks with complex logical decisions?** 48 | 👉 Go with the **CPU**. 49 | 50 | - **Identical, highly parallel tasks, like adding, multiplying, filtering?** 51 | 👉 Go with the **GPU**. 52 | 53 | But if you have both, use both — 54 | and let each do what it does best. 55 | **Now *that* is splitting with wisdom.** 56 | -------------------------------------------------------------------------------- /doc-en/Hibrido-AI-bot.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | ### 📄 Example of Initial Structure for `Hibrido-AI-bot.md` 3 | 4 | # 🤖 Hybrid AI Bot/Robot 5 | 6 | A hybrid project that combines artificial intelligence and robotics to create an intelligent robot capable of communicating with humans, executing physical commands, and learning from the environment. 7 | 8 | ## 🎯 Objectives 9 | 10 | - Integrate AI (chatbot) with a physical robot (Arduino/Raspberry Pi) 11 | - Allow control via text and voice commands 12 | - Learn simple patterns using machine learning 13 | - Develop a graphical interface for control and feedback 14 | 15 | ## 🧠 Artificial Intelligence 16 | 17 | - Language: Python 18 | - Libraries: `transformers`, `speech_recognition`, `pyttsx3` 19 | - Features: 20 | - Response to text commands 21 | - Response to voice commands 22 | - Text generation 23 | - Intent recognition 24 | 25 | ## 🔧 Robotics 26 | 27 | - Platform: Arduino Mega / Raspberry Pi 28 | - Communication: USB / Serial / Bluetooth / Wi-Fi 29 | - Components: 30 | - Servos, DC motors 31 | - Distance sensors 32 | - Status LEDs 33 | - Functions: 34 | - Movement (forward, backward, left, right) 35 | - Obstacle reactions 36 | - Execution of AI commands 37 | 38 | ## 💻 Interface 39 | 40 | - Graphical interface in Python (Tkinter or PyQt) 41 | - Buttons for manual commands 42 | - Text boxes for dialog with the bot 43 | - Robot status feedback 44 | 45 | ## 📡 Communication 46 | 47 | - Serial (Python ↔ Arduino) 48 | - WebSocket (for web interface) 49 | - Local API for commands and sensor reading 50 | 51 | ## 📂 Project Structure 52 | 53 | ``` 54 | Hibrido-AI-bot/ 55 | │ 56 | ├── bot/ 57 | │ └── ai_module.py # AI and language processing 58 | │ 59 | ├── robot/ 60 | │ └── arduino_code.ino # Code for the Arduino 61 | │ └── control.py # Communication with Arduino 62 | │ 63 | ├── interface/ 64 | │ └── gui.py # Window for interaction with the bot 65 | │ 66 | ├── docs/ 67 | │ └── Hibrido-AI-bot.md # Project documentation 68 | │ 69 | └── main.py # Entry point 70 | ``` 71 | 72 | ## 🚀 How to Run 73 | 74 | 1. Install dependencies with `pip install -r requirements.txt` 75 | 2. Connect the Arduino to the PC 76 | 3. Run `python main.py` 77 | 4. Use the interface to interact with the robot 78 | 79 | ## ✅ Current Status 80 | 81 | - [x] Functional AI module 82 | - [x] Basic motor control 83 | - [ ] Full integration with sensors 84 | - [ ] Finalized graphical interface 85 | 86 | ## 📌 Next Steps 87 | 88 | - Improve command recognition 89 | - Train AI with custom phrases 90 | - Optimize real-time response 91 | 92 | ## 📜 License 93 | 94 | Open-source project under the MIT license. 95 | -------------------------------------------------------------------------------- /doc-en/Hibrido-ai.bots.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | 1. **What is the "Hybrid AI bot/robot"?** 3 | - Is it a physical project (with Arduino or Raspberry Pi)? 4 | - Is it a program that simulates a robot? 5 | - Does it use artificial intelligence to respond to commands? In which language? 6 | 7 | 2. **Which part do you want to develop or fix?** 8 | - The code? 9 | - The structure? 10 | - The AI logic? 11 | - The connection between software and hardware? 12 | 13 | 3. **Do you already have any code or basic idea?** 14 | - If so, you can paste it here for me to analyze and correct/improve. 15 | 16 | --- 17 | 18 | Example of a possible **Hybrid AI bot/robot** project with: 19 | - Python + Arduino 20 | - Voice or text commands 21 | - Physical or simulated movement 22 | 23 | If you want, I can create: 24 | - A robot with wheels and sensors, controlled by Python 25 | - A simple AI that responds and sends commands to the robot 26 | - A graphical interface to control the robot or view the responses 27 | -------------------------------------------------------------------------------- /doc-en/Hibrido.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | # The Hybrid Professional: Knowing Robotics 3 | 4 | ## Introduction 5 | 6 | In an increasingly technological world, the concept of the **hybrid professional** is gaining prominence. It refers to someone who combines skills from various areas, capable of acting in an interdisciplinary and innovative manner. In this context, **knowing robotics** becomes a valuable competitive advantage. 7 | 8 | ## What Is a Hybrid Professional? 9 | 10 | A hybrid professional is someone who combines technical knowledge, such as programming and electronics, with human skills, such as creativity, communication, and critical thinking. They are not limited to a single specialization, but rather operate across different fields. 11 | 12 | ### Key Characteristics: 13 | 14 | - Versatility 15 | - Ability to adapt 16 | - Constant curiosity 17 | - Mastery of digital tools 18 | - Collaborative spirit 19 | 20 | ## The Importance of Robotics 21 | 22 | Robotics is no longer just a field of research or industrial production. It is present in education, healthcare, agriculture, transportation, and many other sectors. 23 | 24 | ### Why Learn Robotics? 25 | 26 | - Develops **logical reasoning** and **problem-solving** skills 27 | - Encourages teamwork and **creative thinking** 28 | - Promotes understanding of emerging technologies such as **artificial intelligence** and **automation** 29 | - Enhances career opportunities and adaptation to the future of work 30 | 31 | ## Robotics Skills for a Hybrid Professional 32 | 33 | To incorporate robotics into their profile, a hybrid professional should develop: 34 | 35 | - **Programming** (Python, C++, Scratch, etc.) 36 | - **Basic electronics** (use of sensors, actuators, microcontrollers like Arduino or Raspberry Pi) 37 | - **3D modeling and printing** 38 | - **Basic knowledge of artificial intelligence and machine learning** 39 | - **Ability to design and build mechatronic solutions** 40 | 41 | ## Conclusion 42 | 43 | A hybrid professional who masters robotics concepts is better prepared for the challenges of both the present and the future. This combination of technical and human skills allows them to innovate, solve complex problems, and lead multidisciplinary teams in ever-evolving technological environments. 44 | 45 | > 💡 _Knowing robotics is more than just knowing how to program: it’s about understanding the world we live in and anticipating what is to come._ 46 | -------------------------------------------------------------------------------- /doc-en/Linguagem-Alentejo.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | # Language: Alentejo 3 | 4 | ## Low, Very Low-Level Language 5 | 6 | In Alentejo, people speak slowly... and so does the code. 7 | It’s raw language, machine-like — no frills. 8 | There are no luxuries here, just bits and bytes, 9 | commands going straight to the heart of the machine. 10 | 11 | ## Listening to the Machines 12 | 13 | Learning to listen to them — 14 | from the whisper of **machine code** 15 | to the binary echo that resonates in the **register**. 16 | They are heard with patience, with care. 17 | Each instruction, a command. 18 | Each cycle, a beat. 19 | 20 | ## Digital Electronics 21 | 22 | Taming logic with wires and current. 23 | It’s the use of **controllers**, 24 | the dance of **motors**, 25 | the scent of **sensors**, 26 | and the voices of **communication**. 27 | 28 | Commands that move things. 29 | Current that comes alive. 30 | Gates that open and close with purpose. 31 | 32 | ## Linux Cluster → Swarm of Bots/Robots 33 | 34 | And when the fields fill with silicon, 35 | a **swarm** is born. 36 | Bots and robots working together, 37 | like digital reapers. 38 | 39 | A **Linux cluster**, 40 | where each node talks to another, 41 | synchronized like a GPS-guided herd. 42 | -------------------------------------------------------------------------------- /doc-en/README.md: -------------------------------------------------------------------------------- 1 | - [Portuguese](https://github.com/0joseDark/my-programming-language/blob/main/README.md) 2 | - [translator google](https://github.com/0joseDark/traslator-google-English-Portuguese) 3 | 4 | # future idea: create my own programming language 5 | 6 | - [hardware programming](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/hardware-programming-1.md), [example 1](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/Programacao-por-Hardware-1.md) 7 | 8 | - an old concept, but still relevant 9 | - creating living beings, [Bio-Robotics](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/Bio-Robotica.md) 10 | - respect for other living beings 11 | - name: __Alentejo__ 12 | 13 | ## Simplifying 14 | 15 | - The base of [Alentejo](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/Linguagem-Alentejo.md) is Portuguese 16 | 17 | ### Alentejo = 18 | 19 | - Machine code (`.bin files`) 20 | - Assembler (`.asm files`) 21 | - Python 22 | - HTML 23 | - JavaScript 24 | - CSS 25 | - SQLite or MySQL 26 | - C or C++ 27 | - Portuguese or English 28 | 29 | --- 30 | 31 | - making it more complex, add OpenSim, the 3D simulator with physics 32 | 33 | - - exploring modules for the spacecraft or starship 34 | - studying the rules for the __Alentejo__ language 35 | 36 | --- 37 | 38 | # Communication with Living Beings and Machines 39 | 40 | I can **read**, **listen**, and **speak** with living beings and with machines. 41 | But attention: **I'm not a cyborg**, __I'm truly human__ 😄. 42 | 43 | Currently, I'm **practicing gatez, the cat language**. *lol* 44 | With machines, it's pretty much the same thing: 45 | **studying machine language**! 46 | 47 | I really like **AMD CPUs** and **NVIDIA GPUs**. 48 | I'm going to deepen my study of an **AMD CPU** and use **CUDA** to take advantage of the **NVIDIA GPU**. 49 | 50 | This will allow me to create and train a **neural network**. 51 | -------------------------------------------------------------------------------- /doc-en/hardware-programming-1.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | ### Hardware Programming with Arduino Mega and a Laptop via USB 3 | 4 | **Hardware Programming** using the **Arduino Mega** and a laptop with **USB** ports involves writing code that directly interacts with electronic components connected to the **Arduino**. This allows you to control motors, LEDs, sensors, and other physical devices through commands sent from the computer. 5 | 6 | --- 7 | 8 | ## 1. **Required Materials** 9 | - **Arduino Mega 2560** 10 | - **USB Cable (Type A to Type B)** 11 | - **Laptop (Windows/Linux/macOS)** 12 | - **Arduino IDE Software** 13 | - **Drivers for Arduino Mega** (if necessary) 14 | - **Electronic components** (sensors, LEDs, motors, etc.) 15 | 16 | --- 17 | 18 | ## 2. **Installing and Setting Up the Environment** 19 | 1. **Install the Arduino IDE** 20 | - Download the latest version from: [https://www.arduino.cc/en/software](https://www.arduino.cc/en/software). 21 | - Install it normally on your operating system. 22 | 23 | 2. **Connect the Arduino Mega to the Laptop** 24 | - Use the **USB Type A to Type B** cable to connect the **Arduino Mega** to the laptop. 25 | - If necessary, install the **drivers** so that the computer recognizes the corresponding **COM** port. 26 | 27 | 3. **Select the Board in the Arduino IDE** 28 | - Open the **Arduino IDE**. 29 | - Go to **Tools → Board → Arduino Mega 2560**. 30 | - In **Tools → Port**, select the **COM** port assigned to the Arduino. 31 | 32 | --- 33 | 34 | ## 3. **Writing and Uploading Code to the Arduino** 35 | Now you can program the **Arduino Mega** using C++ code directly in the **Arduino IDE**. 36 | 37 | ### Example: Turning on an LED on Pin 13 38 | ```cpp 39 | void setup() { 40 | pinMode(13, OUTPUT); // Set pin 13 as output 41 | } 42 | 43 | void loop() { 44 | digitalWrite(13, HIGH); // Turn the LED on 45 | delay(1000); // Wait 1 second 46 | digitalWrite(13, LOW); // Turn the LED off 47 | delay(1000); // Wait 1 second 48 | } 49 | ``` 50 | - After writing the code, click **"Upload"** (right arrow button). 51 | - The code will be compiled and sent to the **Arduino Mega**. 52 | - The built-in LED on pin **13** will start blinking. 53 | 54 | --- 55 | 56 | ## 4. **Communication Between Arduino Mega and the Laptop (Serial)** 57 | The **Arduino Mega** can communicate with the laptop through the **USB port**, using **Serial** communication. 58 | 59 | ### Example: Sending and Receiving Data via Serial Monitor 60 | This example allows sending messages from the **Arduino** to the **laptop** and vice versa. 61 | 62 | #### Arduino Code: 63 | ```cpp 64 | void setup() { 65 | Serial.begin(9600); // Start Serial communication at 9600 baud 66 | } 67 | 68 | void loop() { 69 | Serial.println("Arduino Mega connected!"); // Send message to the laptop 70 | delay(1000); // Wait 1 second 71 | } 72 | ``` 73 | - After uploading the code, open the **Serial Monitor** in the Arduino IDE (**Tools → Serial Monitor**). 74 | - You will see the message "Arduino Mega connected!" appearing continuously. 75 | 76 | If you want to receive commands from the computer, modify the code: 77 | ```cpp 78 | void setup() { 79 | Serial.begin(9600); 80 | } 81 | 82 | void loop() { 83 | if (Serial.available()) { // Check if data is received 84 | char command = Serial.read(); // Read the command sent from the laptop 85 | Serial.print("Received: "); 86 | Serial.println(command); // Return the received command 87 | } 88 | } 89 | ``` 90 | Now, if you type something in the **Serial Monitor**, the Arduino will return the same text. 91 | 92 | --- 93 | 94 | ## 5. **Controlling Physical Devices via Laptop** 95 | The **Arduino Mega** can receive commands via **USB** to control **motors, LEDs, servos, and other devices**. 96 | 97 | ### Example: Controlling an LED via USB 98 | #### Arduino Code: 99 | ```cpp 100 | void setup() { 101 | pinMode(13, OUTPUT); 102 | Serial.begin(9600); 103 | } 104 | 105 | void loop() { 106 | if (Serial.available()) { 107 | char command = Serial.read(); 108 | if (command == '1') { 109 | digitalWrite(13, HIGH); // Turn the LED on 110 | Serial.println("LED ON"); 111 | } 112 | if (command == '0') { 113 | digitalWrite(13, LOW); // Turn the LED off 114 | Serial.println("LED OFF"); 115 | } 116 | } 117 | } 118 | ``` 119 | #### Python Code on the Laptop to Control the LED: 120 | ```python 121 | import serial 122 | 123 | serial_port = serial.Serial("COM3", 9600) # Replace COM3 with the correct port 124 | while True: 125 | command = input("Enter 1 to turn on or 0 to turn off: ") 126 | serial_port.write(command.encode()) # Send the command to the Arduino 127 | print(serial_port.readline().decode()) # Read the Arduino's response 128 | ``` 129 | Now, when you enter **"1"**, the LED turns on, and when you enter **"0"**, the LED turns off. 130 | 131 | --- 132 | 133 | ## 6. **Connecting Motors and Sensors** 134 | In addition to LEDs, you can connect **DC motors, stepper motors, servos, temperature sensors, buttons, displays, etc.**. 135 | 136 | ### Example: Controlling a Servo Motor via USB 137 | #### Arduino Code: 138 | ```cpp 139 | #include 140 | 141 | Servo myServo; 142 | 143 | void setup() { 144 | myServo.attach(9); // Servo connected to pin 9 145 | Serial.begin(9600); 146 | } 147 | 148 | void loop() { 149 | if (Serial.available()) { 150 | int angle = Serial.parseInt(); // Read a number sent from the PC 151 | if (angle >= 0 && angle <= 180) { 152 | myServo.write(angle); // Move the servo to the desired angle 153 | Serial.print("Servo at: "); 154 | Serial.println(angle); 155 | } 156 | } 157 | } 158 | ``` 159 | #### Python Code on the Laptop to Control the Servo: 160 | ```python 161 | import serial 162 | 163 | serial_port = serial.Serial("COM3", 9600) # Replace COM3 with the correct port 164 | while True: 165 | angle = input("Enter an angle (0-180): ") 166 | serial_port.write(angle.encode()) # Send the angle to the Arduino 167 | print(serial_port.readline().decode()) # Display the response 168 | ``` 169 | Now you can **control the servo motor by entering angles from 0 to 180 degrees in the Python terminal**. 170 | 171 | --- 172 | 173 | ## 7. **Conclusion** 174 | **Hardware Programming** with the **Arduino Mega** and a laptop via **USB** allows you to: 175 | - **Write code directly on the Arduino**. 176 | - **Communicate with the PC via Serial** for data transmission and reception. 177 | - **Control physical devices like LEDs, motors, and sensors**. 178 | - **Create PC applications that interact with the Arduino in real-time**. 179 | 180 | This is essential for **automation, robotics, and IoT projects**. 181 | -------------------------------------------------------------------------------- /doc-en/hardware-programming.md: -------------------------------------------------------------------------------- 1 | - [back](https://github.com/0joseDark/my-programming-language/blob/main/doc-en/README.md) 2 | ### What is Hardware Programming? 3 | 4 | **Hardware programming** refers to the technique of developing and configuring systems directly at the hardware level, rather than relying solely on traditional processor-based software. This means that instead of writing code to be executed on a general-purpose CPU, the programmer designs and implements functionalities directly in electronic circuits. 5 | 6 | --- 7 | 8 | ### Main Approaches 9 | 10 | 1. **Microcontroller and Embedded Processor Programming** 11 | - Using languages like **C, Assembly, or Python** to directly control **microcontrollers** (e.g., Arduino, ESP32, PIC) and **System-on-Chip (SoC)** devices. 12 | - Example: Programming an Arduino to control motors, sensors, and LEDs. 13 | 14 | 2. **Programmable Logic (FPGAs and CPLDs)** 15 | - Using hardware description languages like **VHDL and Verilog** to create custom digital circuits in **FPGAs (Field-Programmable Gate Arrays)**. 16 | - Example: Creating a custom processor or an acceleration unit for artificial intelligence. 17 | 18 | 3. **Hardware Configuration via Software (Bare-metal Programming)** 19 | - Developing code that interacts directly with **hardware registers**, without relying on an operating system. 20 | - Example: Writing code for a **Raspberry Pi** that interacts directly with GPIO ports. 21 | 22 | --- 23 | 24 | ### Difference Between Hardware Programming and Traditional Programming 25 | 26 | | Feature | Hardware Programming | Traditional Programming | 27 | |--------------|------------------------|----------------------| 28 | | Execution | Directly on hardware (e.g., FPGA, microcontroller) | On a CPU via software (e.g., PC, smartphone) | 29 | | Flexibility | Highly customizable but less adaptable | Easier to modify and update | 30 | | Efficiency | Very fast and optimized | Can be slower due to OS overhead | 31 | | Languages | VHDL, Verilog, Assembly, C | Python, Java, C++, JavaScript | 32 | 33 | --- 34 | 35 | ### Advantages of Hardware Programming 36 | ✅ **High performance** – Can be optimized for specific tasks. 37 | ✅ **Low power consumption** – Ideal for embedded and IoT systems. 38 | ✅ **Real-time response** – Useful for robotics and automation. 39 | 40 | ### Disadvantages 41 | ❌ **Steep learning curve** – Requires knowledge of electronics and digital logic. 42 | ❌ **Less flexible** – Changes require hardware reconfiguration. 43 | 44 | --- 45 | 46 | ### Real-World Applications 47 | 🔹 **Industrial automation** – Controlling motors and sensors. 48 | 🔹 **Robotics** – Precise actuator control. 49 | 🔹 **High-performance computing** – AI and cryptography acceleration. 50 | 🔹 **Critical systems** – Airplanes, satellites, medical devices. 51 | 52 | **Hardware programming** enables the creation of faster, more efficient, and specialized solutions, making it essential in fields such as **robotics, IoT, and artificial intelligence**. 53 | -------------------------------------------------------------------------------- /doc-pt/Bio-Robotica.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ### O que é a Bio-Robótica? 3 | A **Bio-Robótica** é uma área interdisciplinar que combina biologia, robótica e engenharia para desenvolver dispositivos e sistemas inspirados na biologia. Esses sistemas podem incluir: 4 | 5 | - **Próteses e Exoesqueletos**: Dispositivos robóticos que ajudam pessoas com deficiências físicas a recuperar movimentos. 6 | - **Robôs Bio-inspirados**: Máquinas que imitam animais ou organismos vivos para melhorar a mobilidade, eficiência ou adaptação ao ambiente. 7 | - **Interfaces Cérebro-Máquina (ICM)**: Tecnologias que conectam o cérebro humano a dispositivos eletrônicos para controle direto. 8 | - **Nanorrobôs Biomédicos**: Pequenos robôs projetados para atuar dentro do corpo humano, auxiliando em tratamentos médicos, como entrega de medicamentos e reparo de tecidos. 9 | 10 | A bio-robótica tem aplicações na medicina, na indústria e na exploração espacial, ajudando a melhorar a qualidade de vida e expandir as capacidades humanas. 11 | 12 | --- 13 | 14 | ### É possível rescrever o ADN? 15 | Sim, a **edição do ADN** é uma realidade graças a tecnologias como o **CRISPR-Cas9**, que permite modificar sequências genéticas com alta precisão. Esse processo pode ser usado para: 16 | 17 | - **Corrigir mutações genéticas** responsáveis por doenças hereditárias. 18 | - **Criar organismos geneticamente modificados (OGMs)**, como plantas mais resistentes a pragas. 19 | - **Produzir terapias genéticas personalizadas** para tratar doenças como o câncer. 20 | 21 | Apesar do potencial, a edição genética levanta questões éticas e de segurança, especialmente quando se trata de modificar embriões humanos. Por isso, a regulamentação desse campo ainda está em desenvolvimento. 22 | -------------------------------------------------------------------------------- /doc-pt/CPU-or-GPU.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ## Qual o Melhor? **CPU** ou **GPU**? 3 | 4 | Não há resposta única, 5 | como não há uma enxada para todas as terras. 6 | Depende do que se quer lavrar, 7 | e de como se quer repartir o trabalho. 8 | 9 | ### CPU: O Mestre dos Ofícios 10 | 11 | A **CPU** é como um velho sábio: 12 | faz de tudo, com calma e precisão. 13 | Ideal para **tarefas complexas**, 14 | com muita decisão, 15 | muita lógica, 16 | e caminhos que mudam a cada passo. 17 | 18 | - Boa para **controle**, **sequência**, **interpretação**. 19 | - Poucos núcleos, mas **muito versáteis**. 20 | - Excelente em resolver problemas **um de cada vez**, mas com inteligência. 21 | 22 | > “Quando o trabalho exige cabeça, chama-se a CPU.” 23 | 24 | --- 25 | 26 | ### GPU: O Trabalhador em Massa 27 | 28 | A **GPU** é como um batalhão de trabalhadores: 29 | mil braços a fazer o mesmo, em força bruta. 30 | 31 | Feita para **tarefas paralelas**, 32 | como **processamento de imagem**, **redes neurais**, 33 | ou **simulações em larga escala**. 34 | 35 | - Centenas ou milhares de núcleos simples. 36 | - Especialista em fazer **muitas coisas iguais** ao mesmo tempo. 37 | - Ideal para **repartir tarefas idênticas**, sem complicações. 38 | 39 | > “Quando o trabalho exige número e repetição, chama-se a GPU.” 40 | 41 | --- 42 | 43 | ### Então… Qual a Melhor para Repartir Tarefas? 44 | 45 | Depende: 46 | 47 | - **Tarefas variadas, com decisões lógicas complexas?** 48 | 👉 Vai pela **CPU**. 49 | 50 | - **Tarefas iguais, muito paralelas, como somar, multiplicar, filtrar?** 51 | 👉 Vai pela **GPU**. 52 | 53 | Mas se tiveres as duas, usa ambas — 54 | e que cada uma faça o que faz melhor. 55 | **Isso sim é repartir com sabedoria.** 56 | -------------------------------------------------------------------------------- /doc-pt/Hibrido-AI-bot.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ### 📄 Exemplo de Estrutura Inicial para `Hibrido-AI-bot.md` 3 | 4 | # 🤖 Híbrido AI Bot/Robot 5 | 6 | Um projeto híbrido que combina inteligência artificial e robótica para criar um robô inteligente, capaz de comunicar com humanos, executar comandos físicos e aprender com o ambiente. 7 | 8 | ## 🎯 Objetivos 9 | 10 | - Integrar IA (chatbot) com um robô físico (Arduino/Raspberry Pi) 11 | - Permitir controlo por comandos de texto e voz 12 | - Aprender padrões simples com machine learning 13 | - Desenvolver uma interface gráfica para controlo e feedback 14 | 15 | ## 🧠 Inteligência Artificial 16 | 17 | - Linguagem: Python 18 | - Bibliotecas: `transformers`, `speech_recognition`, `pyttsx3` 19 | - Funcionalidades: 20 | - Resposta a comandos de texto 21 | - Resposta a comandos de voz 22 | - Geração de texto 23 | - Reconhecimento de intenção 24 | 25 | ## 🔧 Robótica 26 | 27 | - Plataforma: Arduino Mega / Raspberry Pi 28 | - Comunicação: USB / Serial / Bluetooth / Wi-Fi 29 | - Componentes: 30 | - Servos, motores DC 31 | - Sensores de distância 32 | - LEDs de estado 33 | - Funções: 34 | - Movimento (frente, trás, esquerda, direita) 35 | - Reações a obstáculos 36 | - Execução de ordens da IA 37 | 38 | ## 💻 Interface 39 | 40 | - Interface gráfica em Python (Tkinter ou PyQt) 41 | - Botões para comandos manuais 42 | - Caixas de texto para diálogo com o bot 43 | - Feedback do estado do robô 44 | 45 | ## 📡 Comunicação 46 | 47 | - Serial (Python ↔ Arduino) 48 | - WebSocket (para interface web) 49 | - API local para comandos e leitura de sensores 50 | 51 | ## 📂 Estrutura do Projeto 52 | 53 | ``` 54 | Hibrido-AI-bot/ 55 | │ 56 | ├── bot/ 57 | │ └── ai_module.py # IA e processamento de linguagem 58 | │ 59 | ├── robot/ 60 | │ └── arduino_code.ino # Código para o Arduino 61 | │ └── control.py # Comunicação com o Arduino 62 | │ 63 | ├── interface/ 64 | │ └── gui.py # Janela para interação com o bot 65 | │ 66 | ├── docs/ 67 | │ └── Hibrido-AI-bot.md # Documentação do projeto 68 | │ 69 | └── main.py # Ponto de entrada 70 | ``` 71 | 72 | ## 🚀 Como Executar 73 | 74 | 1. Instalar dependências com `pip install -r requirements.txt` 75 | 2. Ligar o Arduino ao PC 76 | 3. Executar `python main.py` 77 | 4. Usar a interface para interagir com o robô 78 | 79 | ## ✅ Estado Atual 80 | 81 | - [x] Módulo de IA funcional 82 | - [x] Controlo básico de motores 83 | - [ ] Integração completa com sensores 84 | - [ ] Interface gráfica finalizada 85 | 86 | ## 📌 Próximos Passos 87 | 88 | - Melhorar o reconhecimento de comandos 89 | - Treinar IA com frases personalizadas 90 | - Otimizar resposta em tempo real 91 | 92 | ## 📜 Licença 93 | 94 | Projeto open-source sob a licença MIT. 95 | -------------------------------------------------------------------------------- /doc-pt/Hibrido-ai.bots.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | 1. **O que é o "Híbrido AI bot/robot"?** 3 | - É um projeto físico (com Arduino ou Raspberry Pi)? 4 | - É um programa que simula um robô? 5 | - Usa inteligência artificial para responder a comandos? Em que linguagem? 6 | 7 | 2. **Qual parte queres desenvolver ou corrigir?** 8 | - O código? 9 | - A estrutura? 10 | - A lógica da IA? 11 | - A ligação entre software e hardware? 12 | 13 | 3. **Já tens algum código ou ideia-base?** 14 | - Se sim, podes colar aqui para eu analisar e corrigir/melhorar. 15 | 16 | --- 17 | 18 | Exemplo de um possível projeto **Híbrido AI bot/robot** com: 19 | - Python + Arduino 20 | - Comandos de voz ou texto 21 | - Movimento físico ou simulado 22 | 23 | Se quiseres posso criar: 24 | - Um robô com rodas e sensores, comandado por Python 25 | - Uma IA simples que responde e envia comandos para o robô 26 | - Uma interface gráfica para controlar o robô ou ver as respostas 27 | -------------------------------------------------------------------------------- /doc-pt/Hibrido.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | - pode O Profissional Híbrido: Saber Robótica 3 | 4 | ## Introdução 5 | 6 | Num mundo cada vez mais tecnológico, o conceito de **profissional híbrido** ganha destaque. Trata-se de alguém que combina competências de diversas áreas, sendo capaz de atuar de forma interdisciplinar e inovadora. Neste contexto, **saber robótica** torna-se uma vantagem competitiva valiosa. 7 | 8 | ## O Que é um Profissional Híbrido? 9 | 10 | O profissional híbrido é aquele que une conhecimentos técnicos, como programação e eletrónica, com competências humanas, como criatividade, comunicação e pensamento crítico. Ele não se limita a uma única especialização, mas sim atua de forma transversal em diferentes áreas. 11 | 12 | ### Características principais: 13 | 14 | - Versatilidade 15 | - Capacidade de adaptação 16 | - Curiosidade constante 17 | - Domínio de ferramentas digitais 18 | - Espírito colaborativo 19 | 20 | ## A Importância da Robótica 21 | 22 | A robótica já não é apenas uma área de investigação ou produção industrial. Está presente na educação, saúde, agricultura, transportes, entre muitos outros setores. 23 | 24 | ### Por que aprender robótica? 25 | 26 | - Desenvolve o **raciocínio lógico** e a **resolução de problemas** 27 | - Estimula o trabalho em equipa e o **pensamento criativo** 28 | - Promove o entendimento de tecnologias emergentes como **inteligência artificial** e **automação** 29 | - Melhora as oportunidades de carreira e adaptação ao futuro do trabalho 30 | 31 | ## Competências em Robótica para um Profissional Híbrido 32 | 33 | Para integrar a robótica no seu perfil, um profissional híbrido deve desenvolver: 34 | 35 | - **Programação** (Python, C++, Scratch, etc.) 36 | - **Eletrónica básica** (uso de sensores, atuadores, microcontroladores como Arduino ou Raspberry Pi) 37 | - **Modelação e impressão 3D** 38 | - **Noções de inteligência artificial e machine learning** 39 | - **Capacidade de projetar e construir soluções mecatrónicas** 40 | 41 | ## Conclusão 42 | 43 | O profissional híbrido que domina conceitos de robótica está melhor preparado para os desafios do presente e do futuro. Esta combinação de competências técnicas e humanas permite-lhe inovar, resolver problemas complexos e liderar equipas multidisciplinares em ambientes tecnológicos em constante mudança. 44 | 45 | > 💡 _Saber robótica é mais do que saber programar: é compreender o mundo em que vivemos e antecipar o que está por vir.. 46 | -------------------------------------------------------------------------------- /doc-pt/Linguagem-Alentejo.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | # Linguagem: Alentejo 3 | 4 | ## Linguagem Baixo, Baixo Nível 5 | 6 | No Alentejo, fala-se devagar... e no código também. 7 | É linguagem crua, de máquina — sem rodeios. 8 | Aqui não há luxos, só bits e bytes, 9 | comandos que vão direitinhos ao coração da máquina. 10 | 11 | ## Escutar as Máquinas 12 | 13 | Aprender a escutá-las — 14 | desde o sussurro do **código de máquina** 15 | até ao eco binário que vibra no **registrador**. 16 | Ouvem-se com paciência, com atenção. 17 | Cada instrução, uma ordem. 18 | Cada ciclo, um compasso. 19 | 20 | ## Eletrónica Digital 21 | 22 | Domar a lógica com fios e corrente. 23 | É o uso dos **controladores**, 24 | a dança dos **motores**, 25 | o faro dos **sensores**, 26 | e as vozes da **comunicação**. 27 | 28 | Comandos que mexem coisas. 29 | Corrente que ganha vida. 30 | Portas que se abrem e fecham com propósito. 31 | 32 | ## Cluster Linux → Enxame de Bots/Robots 33 | 34 | E quando os campos se enchem de silício, 35 | nasce o **enxame**. 36 | Bots e robots que trabalham juntos, 37 | como ceifeiros digitais. 38 | 39 | Um **cluster Linux**, 40 | onde cada nodo fala com outro, 41 | sincronizado como um rebanho com GPS. 42 | -------------------------------------------------------------------------------- /doc-pt/Multiplos-Bots-Robots.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ## Usar Múltiplos Bots/Robots 3 | 4 | Quando o problema é grande — 5 | não se assusta o Alentejano, nem o engenheiro. 6 | Divide-se. 7 | Parte-se como quem reparte pão. 8 | 9 | ### Simplificar é Repartir 10 | 11 | A arte está em **simplificar o problema**, 12 | em saber olhar para o todo 13 | e ver onde se pode **cortar aos bocadinhos**. 14 | 15 | Como se fosse uma eira: 16 | cada bot apanha uma parte da seara. 17 | 18 | ### Subproblemas: Pequenos Saberes 19 | 20 | Cada bot, cada robot, 21 | fica com o seu **subproblema** — 22 | mais leve, mais claro, mais resolúvel. 23 | 24 | Enquanto um mede, outro anda. 25 | Enquanto um comunica, outro calcula. 26 | **Paralelo puro, como formigas em fila.** 27 | 28 | ### Enxame Inteligente 29 | 30 | Juntos, resolvem o que sozinho não se alcança. 31 | Trabalham como enxame: 32 | sincronizados, coordenados, com propósito. 33 | -------------------------------------------------------------------------------- /doc-pt/Programacao-por-Hardware-1.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ### Programação por Hardware com Arduino Mega e um Portátil via USB 3 | 4 | A **Programação por Hardware** utilizando o **Arduino Mega** e um portátil com portas **USB** envolve a criação de código que interage diretamente com os componentes eletrónicos conectados ao **Arduino**. Isto permite controlar motores, LEDs, sensores e outros dispositivos físicos através de comandos enviados pelo computador. 5 | 6 | --- 7 | 8 | ## 1. **Materiais Necessários** 9 | - **Arduino Mega 2560** 10 | - **Cabo USB (Tipo A para Tipo B)** 11 | - **Computador portátil (Windows/Linux/macOS)** 12 | - **Software Arduino IDE** 13 | - **Drivers para Arduino Mega** (caso seja necessário) 14 | - **Componentes eletrónicos** (sensores, LEDs, motores, etc.) 15 | 16 | --- 17 | 18 | ## 2. **Instalar e Configurar o Ambiente** 19 | 1. **Instalar o Arduino IDE** 20 | - Descarregar a versão mais recente em: [https://www.arduino.cc/en/software](https://www.arduino.cc/en/software). 21 | - Instalar normalmente no seu sistema operativo. 22 | 23 | 2. **Ligar o Arduino Mega ao Portátil** 24 | - Usar o cabo **USB Tipo A para Tipo B** para conectar o **Arduino Mega** ao portátil. 25 | - Se necessário, instalar os **drivers** para que o computador reconheça a porta **COM** correspondente. 26 | 27 | 3. **Selecionar a Placa no Arduino IDE** 28 | - Abrir o **Arduino IDE**. 29 | - Ir a **Ferramentas → Placa → Arduino Mega 2560**. 30 | - Em **Ferramentas → Porta**, selecionar a porta **COM** atribuída ao Arduino. 31 | 32 | --- 33 | 34 | ## 3. **Escrever e Enviar Código para o Arduino** 35 | Agora pode programar o **Arduino Mega** com código C++ diretamente no **Arduino IDE**. 36 | 37 | ### Exemplo: Acender um LED no pino 13 38 | ```cpp 39 | void setup() { 40 | pinMode(13, OUTPUT); // Define o pino 13 como saída 41 | } 42 | 43 | void loop() { 44 | digitalWrite(13, HIGH); // Acende o LED 45 | delay(1000); // Espera 1 segundo 46 | digitalWrite(13, LOW); // Apaga o LED 47 | delay(1000); // Espera 1 segundo 48 | } 49 | ``` 50 | - Após escrever o código, clique em **"Carregar"** (botão de seta para a direita). 51 | - O código será compilado e enviado para o **Arduino Mega**. 52 | - O LED embutido no pino **13** começará a piscar. 53 | 54 | --- 55 | 56 | ## 4. **Comunicação entre o Arduino Mega e o Portátil (Serial)** 57 | O **Arduino Mega** pode comunicar com o portátil através da **porta USB**, usando a comunicação **Serial**. 58 | 59 | ### Exemplo: Enviar e Receber Dados pelo Monitor Serial 60 | Este exemplo permite enviar mensagens do **Arduino** para o **portátil** e vice-versa. 61 | 62 | #### Código para o Arduino: 63 | ```cpp 64 | void setup() { 65 | Serial.begin(9600); // Inicia a comunicação Serial a 9600 baud 66 | } 67 | 68 | void loop() { 69 | Serial.println("Arduino Mega ligado!"); // Envia mensagem para o portátil 70 | delay(1000); // Aguarda 1 segundo 71 | } 72 | ``` 73 | - Após carregar o código, abra o **Monitor Serial** no Arduino IDE (**Ferramentas → Monitor Serial**). 74 | - Verá a mensagem "Arduino Mega ligado!" a aparecer continuamente. 75 | 76 | Se quiser receber comandos do computador, pode modificar o código: 77 | ```cpp 78 | void setup() { 79 | Serial.begin(9600); 80 | } 81 | 82 | void loop() { 83 | if (Serial.available()) { // Verifica se há dados recebidos 84 | char comando = Serial.read(); // Lê o comando enviado pelo portátil 85 | Serial.print("Recebi: "); 86 | Serial.println(comando); // Retorna o que recebeu 87 | } 88 | } 89 | ``` 90 | Agora, se escrever algo no **Monitor Serial**, o Arduino devolverá o mesmo texto. 91 | 92 | --- 93 | 94 | ## 5. **Controlar Dispositivos Físicos pelo Portátil** 95 | O **Arduino Mega** pode receber comandos via **USB** para controlar **motores, LEDs, servos e outros dispositivos**. 96 | 97 | ### Exemplo: Controlar um LED via USB 98 | #### Código para o Arduino: 99 | ```cpp 100 | void setup() { 101 | pinMode(13, OUTPUT); 102 | Serial.begin(9600); 103 | } 104 | 105 | void loop() { 106 | if (Serial.available()) { 107 | char comando = Serial.read(); 108 | if (comando == '1') { 109 | digitalWrite(13, HIGH); // Acende o LED 110 | Serial.println("LED ON"); 111 | } 112 | if (comando == '0') { 113 | digitalWrite(13, LOW); // Apaga o LED 114 | Serial.println("LED OFF"); 115 | } 116 | } 117 | } 118 | ``` 119 | #### Código Python no Portátil para Controlar o LED: 120 | ```python 121 | import serial 122 | 123 | porta_serial = serial.Serial("COM3", 9600) # Substituir COM3 pela porta correta 124 | while True: 125 | comando = input("Digite 1 para acender ou 0 para apagar: ") 126 | porta_serial.write(comando.encode()) # Envia o comando para o Arduino 127 | print(porta_serial.readline().decode()) # Lê a resposta do Arduino 128 | ``` 129 | Agora, ao digitar **"1"**, o LED acende, e ao digitar **"0"**, o LED apaga. 130 | 131 | --- 132 | 133 | ## 6. **Ligar Motores e Sensores** 134 | Além de LEDs, pode ligar **motores DC, motores de passo, servos, sensores de temperatura, botões, displays, etc.**. 135 | 136 | ### Exemplo: Controlar um Servo Motor via USB 137 | #### Código para o Arduino: 138 | ```cpp 139 | #include 140 | 141 | Servo meuServo; 142 | 143 | void setup() { 144 | meuServo.attach(9); // Servo ligado ao pino 9 145 | Serial.begin(9600); 146 | } 147 | 148 | void loop() { 149 | if (Serial.available()) { 150 | int angulo = Serial.parseInt(); // Lê um número enviado pelo PC 151 | if (angulo >= 0 && angulo <= 180) { 152 | meuServo.write(angulo); // Move o servo para o ângulo desejado 153 | Serial.print("Servo em: "); 154 | Serial.println(angulo); 155 | } 156 | } 157 | } 158 | ``` 159 | #### Código Python no Portátil para Controlar o Servo: 160 | ```python 161 | import serial 162 | 163 | porta_serial = serial.Serial("COM3", 9600) # Substituir COM3 pela porta correta 164 | while True: 165 | angulo = input("Digite um ângulo (0-180): ") 166 | porta_serial.write(angulo.encode()) # Envia o ângulo para o Arduino 167 | print(porta_serial.readline().decode()) # Exibe a resposta 168 | ``` 169 | Agora pode **controlar o servo motor digitando ângulos de 0 a 180 graus no terminal Python**. 170 | 171 | --- 172 | 173 | ## 7. **Conclusão** 174 | A **Programação por Hardware** com o **Arduino Mega** e um portátil via **USB** permite: 175 | - **Escrever código diretamente no Arduino**. 176 | - **Comunicar com o PC via Serial** para envio e receção de dados. 177 | - **Controlar dispositivos físicos como LEDs, motores e sensores**. 178 | - **Criar aplicações no PC que interagem com o Arduino em tempo real**. 179 | 180 | Isto é essencial para projetos de **automação, robótica e IoT** 181 | -------------------------------------------------------------------------------- /doc-pt/programação-por-hardware.md: -------------------------------------------------------------------------------- 1 | - [voltar](https://github.com/0joseDark/minha-linguagem-programacao/blob/main/README.md) 2 | ### O que é Programação por Hardware? 3 | 4 | A **programação por hardware** refere-se à técnica de desenvolver e configurar sistemas diretamente no nível do hardware, em vez de depender exclusivamente de software tradicional baseado em processadores. Isso significa que, em vez de escrever código para ser executado num CPU de propósito geral, o programador projeta e implementa funcionalidades diretamente em circuitos eletrónicos. 5 | 6 | --- 7 | 8 | ### Principais Abordagens 9 | 10 | 1. **Programação de Microcontroladores e Processadores Embebidos** 11 | - Uso de linguagens como **C, Assembly ou Python** para controlar diretamente **microcontroladores** (ex.: Arduino, ESP32, PIC) e **Sistemas em Chip (SoC)**. 12 | - Exemplo: Programar um Arduino para acionar motores, sensores e LEDs. 13 | 14 | 2. **Lógica Programável (FPGAs e CPLDs)** 15 | - Uso de linguagens de descrição de hardware, como **VHDL e Verilog**, para criar circuitos digitais personalizados em **FPGAs (Field-Programmable Gate Arrays)**. 16 | - Exemplo: Criar um processador personalizado ou uma unidade de aceleração para inteligência artificial. 17 | 18 | 3. **Configuração de Hardware por Software (Bare-metal Programming)** 19 | - Desenvolvimento de código que interage diretamente com **registos de hardware**, sem depender de um sistema operativo. 20 | - Exemplo: Escrever código para um **Raspberry Pi** que interaja diretamente com portas GPIO. 21 | 22 | --- 23 | 24 | ### Diferença entre Programação por Hardware e Programação Tradicional 25 | 26 | | Característica | Programação por Hardware | Programação Tradicional | 27 | |--------------|------------------------|----------------------| 28 | | Execução | No próprio hardware (ex.: FPGA, microcontrolador) | No CPU via software (ex.: PC, smartphone) | 29 | | Flexibilidade | Alta personalização, mas menos adaptável | Mais fácil de modificar e atualizar | 30 | | Eficiência | Muito rápida e otimizada | Pode ser mais lenta devido à sobrecarga do SO | 31 | | Linguagens | VHDL, Verilog, Assembly, C | Python, Java, C++, JavaScript | 32 | 33 | --- 34 | 35 | ### Vantagens da Programação por Hardware 36 | ✅ **Alto desempenho** – Pode ser otimizada para tarefas específicas. 37 | ✅ **Baixo consumo de energia** – Ideal para sistemas embebidos e IoT. 38 | ✅ **Resposta em tempo real** – Útil para robótica e automação. 39 | 40 | ### Desvantagens 41 | ❌ **Curva de aprendizagem elevada** – Requer conhecimento de eletrónica e lógica digital. 42 | ❌ **Menos flexível** – Alterações exigem reconfiguração do hardware. 43 | 44 | --- 45 | 46 | ### Aplicações Reais 47 | 🔹 **Automação industrial** – Controlo de motores e sensores. 48 | 🔹 **Robótica** – Controle preciso de atuadores. 49 | 🔹 **Computação de alto desempenho** – Aceleração de IA e criptografia. 50 | 🔹 **Sistemas críticos** – Aviões, satélites, dispositivos médicos. 51 | 52 | A **programação por hardware** permite criar soluções mais rápidas, eficientes e especializadas, sendo essencial em áreas como **robótica, IoT e inteligência artificial**. 53 | --------------------------------------------------------------------------------