diff --git a/README.md b/README.md index ea89bcb..02a4a68 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,9 @@ Then use a Qt interface to query the value in the arduino. Create an arduino driver, the corresponding sketch and upload it. Then use a Qt interface to query the value in the arduino periodically -or plot it. \ No newline at end of file +or plot it. + +#### arduino-qt-toogle-led + +Create an arduino driver, the corresponding sketch and upload it. +The use a Qt interface with ON OFF buttons to set an arduino LED. diff --git a/arduino-qt-continuous/README.md b/arduino-qt-continuous/README.md index c6145cc..f8670b1 100644 --- a/arduino-qt-continuous/README.md +++ b/arduino-qt-continuous/README.md @@ -1,87 +1,96 @@ -arduino-qt-continuous -===================== - -This example shows: -- how to build an instrument that communicates via -exchanging text messages using arduino and lantz. -- how to query that instrument periodically -- how to plot the results in a chart - - -Requirements ------------- - -- Install the latest version of lantz - -- Install arduino-cli - https://github.com/arduino/arduino-cli - -- (optionally) Install pyqtgraph if you want to run the run_plot example - -- Copy all the content of this folder to your computer - -If you do not have the NI-VISA installed, you need to install `pyvisa-py` -(the pure python backend for pyvisa) and tell lantz to use it by default - -In the command line: - - pip install pyvisa-py - pip install pyserial - lantz config core.visa_backend '@py' - - -Step 1: Create arduino sketch template --------------------------------------- - -In the console, go to the folder containing this project and execute the following -command: - - lantz ino new drivers:TemperatureSensor - -This will generate a arduino sketch template for the class `TemperatureSensor` -located in the `run` module. You will find it in the TemperatureSensor folder. -It additionally creates a "packfile" named `TemperatureSensor.pack.yaml` that -contains information to compile and upload the project. - - -Step 2 (optional): Add your own code to the arduino sketch ----------------------------------------------------------- - -You can customize the arduino code by editing `inodriver_user.cpp` and -`inodriver_user.h` within the sketch folder. - -You will find the following functions: - -- user_setup: this will be executed during the setup of the arduino just before starting - the communication with the serial command. - -- user_loop: this will be executed every time the main loop is executed - -- ... and one function for each getter/setter you have in your lantz code. - -You can just use the default code to get working but dummy example. - - -Step 3: Run it --------------- - -In the console, go to the folder containing this project and execute the following -command: - - python run_display.py - - -Step 4 (optional): Change something in the arduino sketch ---------------------------------------------------------- - -Edit `inodriver_user.cpp`, for example to return 42.0 from `get_TEMP` -and run the code again. Notice that lanz recompiles and upload the sketch! - - -Step 5 (optional): Run the plotting example -------------------------------------------- - -In the console, go to the folder containing this project and execute the following -command: - - python run_plot.py \ No newline at end of file +arduino-qt-continuous +===================== + +This example shows: +- how to build an instrument that communicates via +exchanging text messages using arduino and lantz. +- how to query that instrument periodically +- how to plot the results in a chart + + +Requirements +------------ + +- Install the latest version of lantz + +- Install arduino-cli + https://github.com/arduino/arduino-cli + + _windows:_ + Make sure you included the arduino-cli in your enviroment variables PATH. + From the command prompt: + * Check your installation by doing `arduino-cli` + * Install the AVR dependencies `arduino-cli core install arduino:avr` + + +- (optionally) Install pyqtgraph if you want to run the run_plot example + +- Copy all the content of this folder to your computer + +If you do not have the NI-VISA installed, you need to install `pyvisa-py` +(the pure python backend for pyvisa) and tell lantz to use it by default + +In the command line: + + pip install pyvisa-py + pip install pyserial + lantz config core.visa_backend '@py' + + +Step 1: Create arduino sketch template +-------------------------------------- + +In the console, go to the folder containing this project and execute the following +command: + + lantz ino new drivers:TemperatureSensor + +This will generate a arduino sketch template for the class `TemperatureSensor` +located in the `run` module. You will find it in the TemperatureSensor folder. +It additionally creates a "packfile" named `TemperatureSensor.pack.yaml` that +contains information to compile and upload the project. + + +Step 2 (optional): Add your own code to the arduino sketch +---------------------------------------------------------- + +You can customize the arduino code by editing `inodriver_user.cpp` and +`inodriver_user.h` within the sketch folder. + +You will find the following functions: + +- user_setup: this will be executed during the setup of the arduino just before starting + the communication with the serial command. + +- user_loop: this will be executed every time the main loop is executed + +- ... and one function for each getter/setter you have in your lantz code. + +You can just use the default code to get working but dummy example. + + +Step 3: Run it +-------------- + +In the console, go to the folder containing this project and execute the following +command: + + python run_display.py + +If you get a __json error__ read carfully the notes it states you should update the index using `arduino-cli core-update index` + + +Step 4 (optional): Change something in the arduino sketch +--------------------------------------------------------- + +Edit `inodriver_user.cpp`, for example to return 42.0 from `get_TEMP` +and run the code again. Notice that lanz recompiles and upload the sketch! + + +Step 5 (optional): Run the plotting example +------------------------------------------- + +In the console, go to the folder containing this project and execute the following +command: + + python run_plot.py diff --git a/arduino-qt-simple/README.md b/arduino-qt-simple/README.md index 82c4e09..fb31c17 100644 --- a/arduino-qt-simple/README.md +++ b/arduino-qt-simple/README.md @@ -1,72 +1,80 @@ -arduino-qt-simple -================= - -This is a very simple example of how to build an instrument that communicates via -exchanging text messages using arduino and lantz. - -Requirements ------------- - -- Install the latest version of lantz - -- Install arduino-cli - https://github.com/arduino/arduino-cli - -- Copy all the content of this folder to your computer - -If you do not have the NI-VISA installed, you need to install `pyvisa-py` -(the pure python backend for pyvisa) and tell lantz to use it by default - -In the command line: - - pip install pyvisa-py - pip install pyserial - lantz config core.visa_backend '@py' - - -Step 1: Create arduino sketch template --------------------------------------- - -In the console, go to the folder containing this project and execute the following -command: - - lantz ino new run:TemperatureSensor - -This will generate a arduino sketch template for the class `TemperatureSensor` -located in the `run` module. You will find it in the TemperatureSensor folder. -It additionally creates a "packfile" named `TemperatureSensor.pack.yaml` that -contains information to compile and upload the project. - - -Step 2 (optional): Add your own code to the arduino sketch ----------------------------------------------------------- - -You can customize the arduino code by editing `inodriver_user.cpp` and -`inodriver_user.h` within the sketch folder. - -You will find the following functions: - -- user_setup: this will be executed during the setup of the arduino just before starting - the communication with the serial command. - -- user_loop: this will be executed every time the main loop is executed - -- ... and one function for each getter/setter you have in your lantz code. - -You can just use the default code to get working but dummy example. - - -Step 3: Run it --------------- - -In the console, go to the folder containing this project and execute the following -command: - - python run.py - - -Step 4 (optional): Change something in the arduino sketch ---------------------------------------------------------- - -Edit `inodriver_user.cpp`, for example to return 42.0 from `get_TEMP` -and run the code again. Notice that lanz recompiles and upload the sketch! \ No newline at end of file +arduino-qt-simple +================= + +This is a very simple example of how to build an instrument that communicates via +exchanging text messages using arduino and lantz. + +Requirements +------------ + +- Install the latest version of lantz + +- Install arduino-cli + https://github.com/arduino/arduino-cli + + _windows:_ + Make sure you included the arduino-cli in your enviroment variables PATH. + From the command prompt: + * Check your installation by doing `arduino-cli` + * Install the AVR dependencies `arduino-cli core install arduino:avr` + +- Copy all the content of this folder to your computer + +If you do not have the NI-VISA installed, you need to install `pyvisa-py` +(the pure python backend for pyvisa) and tell lantz to use it by default + +In the command line: + + pip install pyvisa-py + pip install pyserial + lantz config core.visa_backend @py + + +Step 1: Create arduino sketch template +-------------------------------------- + +In the console, go to the folder containing this project and execute the following +command: + + lantz ino new run:TemperatureSensor + +This will generate a arduino sketch template for the class `TemperatureSensor` +located in the `run` module. You will find it in the TemperatureSensor folder. +It additionally creates a "packfile" named `TemperatureSensor.pack.yaml` that +contains information to compile and upload the project. + + +Step 2 (optional): Add your own code to the arduino sketch +---------------------------------------------------------- + +You can customize the arduino code by editing `inodriver_user.cpp` and +`inodriver_user.h` within the sketch folder. + +You will find the following functions: + +- user_setup: this will be executed during the setup of the arduino just before starting + the communication with the serial command. + +- user_loop: this will be executed every time the main loop is executed + +- ... and one function for each getter/setter you have in your lantz code. + +You can just use the default code to get working but dummy example. + + +Step 3: Run it +-------------- + +In the console, go to the folder containing this project and execute the following +command: + + python run.py + +If you get a __json error__ read carfully the notes it states you should update the index using `arduino-cli core-update index` + + +Step 4 (optional): Change something in the arduino sketch +--------------------------------------------------------- + +Edit `inodriver_user.cpp`, for example to return 42.0 from `get_TEMP` +and run the code again. Notice that lanz recompiles and upload the sketch! diff --git a/arduino-qt-toogle-led/README.md b/arduino-qt-toogle-led/README.md index 0b40bc1..d8f754b 100644 --- a/arduino-qt-toogle-led/README.md +++ b/arduino-qt-toogle-led/README.md @@ -1,88 +1,109 @@ -arduino-qt-toogle-led -===================== - -This is a very simple example of how to build an instrument that communicates via -exchanging text messages using arduino and lantz. - -Requirements ------------- - -- Install the latest version of lantz - -- Install arduino-cli - https://github.com/arduino/arduino-cli - -- Copy all the content of this folder to your computer - -If you do not have the NI-VISA installed, you need to install `pyvisa-py` -(the pure python backend for pyvisa) and tell lantz to use it by default - -In the command line: - - pip install pyvisa-py - pip install pyserial - lantz config core.visa_backend '@py' - - -Step 1: Create arduino sketch template --------------------------------------- - -In the console, go to the folder containing this project and execute the following -command: - - lantz ino new run:TemperatureSensor - -This will generate an arduino sketch template for the class `LEDDriver` -located in the `run` module. You will find it in the LEDDriver just created directory. -It additionally creates a "packfile" named `LEDDriver.pack.yaml` that -contains information to compile and upload the project. - - -Step 2: Add your own code to the arduino sketch ------------------------------------------------ - -You can customize the arduino code by editing `inodriver_user.cpp` and -`inodriver_user.h` within the sketch directory created in step 1. - -You will find the following functions: - -- user_setup: this will be executed during the setup of the arduino just before starting - the communication with the serial command. - -- user_loop: this will be executed every time the main loop is executed - -- ... and one function for each getter/setter you have in your lantz code. - -In order to get the onboard LED turned on an off, we need to modify the -`inodriver_user.cpp` file in the following manner: -``` -... stuff ... -void user_setup() { - pinMode(13, OUTPUT); -} -... stuff ... -int set_LED(int value) { - if (value>0) - digitalWrite(13, HIGH); - else - digitalWrite(13, LOW); - return 0; -}; -... stuff ... -``` - - -Step 3: Run it --------------- - -In the console, go to the directory containing this project and execute the following -command: - - python run.py - -This should open the graphical interface with two buttons, one to turn the LED on -and the other to turn the LED off. - -
-
-
+
+