commit 9e066b376e3b41d3d55236cb81e02e0f0fd32a5c Author: prisar Date: Fri Jul 21 13:48:41 2023 +0530 add flashing and pyqt setup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb5f3ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.DS_Store +/env +build +dist \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..724b60a --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +### error -> FileNotFoundError: [Errno 2] No such file or directory: 'arduino-cli' + + install arduino-cli + +https://arduino.github.io/arduino-cli/0.33/installation/ \ No newline at end of file diff --git a/flash.py b/flash.py new file mode 100644 index 0000000..ca7770e --- /dev/null +++ b/flash.py @@ -0,0 +1,66 @@ +from everywhereml.arduino import Sketch, Ino, H + +""" +Create a sketch object. +A sketch is defined by: + - a name (required) + - a folder (optional) + +If you leave the folder empty, the current working directory will be used. +You can use the special name ':system:' to use the default Arduino sketches folder +(as reported by the command `arduino-cli config dump`) +""" + +sketch = Sketch(name="PyDuino", folder=":system:") + +""" +Then you can add files to the project (either the .ino main file or +C++ header files) +""" +sketch += Ino(""" + #include "hello.h" + + + void setup() { + Serial.begin(115200); + } + + void loop() { + hello(); + delay(1000); + } +""") + +sketch += H("hello.h", """ + void hello() { + Serial.println("hello smi5"); + } +""") + +""" +Compile sketch for Arduino Nano 33 BLE board. +The board you target must appear in the `arduino-cli board listall` command. +If you know the FQBN (Fully Qualified Board Name), you can use that too. +""" +if sketch.compile(board='arduino:avr:nano:cpu=atmega328old').is_successful: + print('Log', sketch.output) + print('Sketch stats', sketch.stats) +else: + print('ERROR', sketch.output) + + +""" +You can specify the exact port +""" +# sketch.upload(port='/dev/cu.usbmodem14201') + +sketch.upload(port='/dev/cu.usbserial-1420') + +# """ +# Or even part of it. +# The library will look for the best match. +# """ +# sketch.upload(port='ttyUSB') +# sketch.upload(port='/dev/cu.usbserial-1420') #/dev/cu.usbmodem + +print(sketch.output) \ No newline at end of file diff --git a/hemocube.py b/hemocube.py new file mode 100644 index 0000000..d90ab44 --- /dev/null +++ b/hemocube.py @@ -0,0 +1,40 @@ +import sys +from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit + +# 1. Import QApplication and all the required widgets +# from PyQt5.QtWidgets import QApplication, QLabel, QWidget + +def addLabel(layout, text): + layout.addWidget(QLabel(text)) + +if __name__ == "__main__": + app = QApplication([]) + + window = QWidget() + layout = QVBoxLayout(window) + # Create a label Widget and add it to the layout + label = QLabel('Enter some text!') + layout.addWidget(label) + + line_edit = QLineEdit() + layout.addWidget(line_edit) + + # Create a QPushButton object with a caption on it + qbtn= QPushButton('Add Label') + + # Add the QPushButton to the layout + layout.addWidget(qbtn) + + # Close the application when the button is pressed + # Here I am using slots & signals, which I will demonstrate later in this tutorial + qbtn.clicked.connect(lambda:addLabel(layout, line_edit.text())) + + window.setWindowTitle("PyQt App") + window.setGeometry(100, 100, 280, 80) + # helloMsg = QLabel("

Hello, World!

", parent=window) + # helloMsg.move(60, 15) + + window.show() + + # 5. Run your application's event loop + sys.exit(app.exec()) diff --git a/hemocube.spec b/hemocube.spec new file mode 100644 index 0000000..84a04c7 --- /dev/null +++ b/hemocube.spec @@ -0,0 +1,50 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis( + ['hemocube.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False, +) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='hemocube', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) +coll = COLLECT( + exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='hemocube', +)