IoT

install, setup, config jetson nano with opencv ai kit (depth camera) OAK-D 

install and setup visual studio code server in jetson nano and use it on iPad by ssh 

config vscode to run CUDA 

VSCode on iPad Pro - Full Setup Guide with Jetson Nano

https://www.tiziran.com/topics-and-projects/source-code/iot 

#iPad #VSCode #IoT #ssh #Jetson #CUDA #C++

www.tiziran.com March 2023

https://www.tiziran.com/topics-and-projects/source-code/iot 

VSCode on iPad Pro - Full Setup Guide with Jetson Nano


// Install VSCode server

sudo apt-get install curl

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

sudo apt-get update && sudo apt-get install yarn

Y

sudo apt-get install -y nodejs

sudo npm --force  install -g yarn

yarn global add code-server

~/.yarn/bin/code-server


// config VSCode server to use by other device like iPad, ... in local network

~/.yarn/bin/code-server

gedit ~/.config/code-server/config.yaml

bind-addr: 0.0.0.0:8080

auth: none

password: tiziran

cert: false

sudo gedit /etc/systemd/system/code-server.service

[Unit]

Description=code-server

After=network.target


[Service]

User=pi

Group=pi


WorkingDirectory=/home/pi

Environment="PATH=/usr/bin"

ExecStart=/home/tiziran/.yarn/bin/code-server


[Install]

WantedBy=multi-user.target

sudo systemctl stop code-server

~/.yarn/bin/code-server


// just run this command after restart device

~/.yarn/bin/code-server

http://tiziran.local:8080/  => name of your device 





// CUDA config for VSCode

// https://www.tiziran.com/topics-and-projects/source-code/iot

open foldr in VSCode code-server .






// web python testing 

sudo apt-get install chromium-chromedriver

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

import time

# Launch the browser and open the website

driver = webdriver.Chrome()

driver.get("https://www.tiziran.com/")

# Save a screenshot of the page

driver.save_screenshot("tiziran.png")

# Close the browser

driver.quit()



sudo apt install virtualenv

 virtualenv --python=python3.8 tiziran

source tiziran/bin/activate





























sudo apt-get install python3.8

sudo rm /usr/bin/python3

sudo ln -s /usr/bin/python3.8 /usr/bin/python3


sudo apt-get --reinstall install python3-minimal 




tasks.json

{

   "version": "2.0.0",

   "tasks": [

       {

           "label": "build",

           "type": "shell",

           "command": "/usr/local/cuda/bin/nvcc",

           "args": [

               "-gencode",

               "arch=compute_53,code=sm_53",

               "-I${workspaceFolder}",

               "-o",

               "${workspaceFolder}/${fileBasenameNoExtension}",

               "${file}",

               "-g"

              

           ],

           "group": {

               "kind": "build",

               "isDefault": true

           },

           "presentation": {

               "echo": true,

               "reveal": "always",

               "focus": false,

               "panel": "shared"

           },

           "problemMatcher": {

               "owner": "cpp",

               "fileLocation": ["absolute"],

               "pattern": {

                   "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",

                   "file": 1,

                   "line": 2,

                   "column": 3,

                   "severity": 4,

                   "message": 5

               }

           }

       }

   ]

}






launch.json



{

   "version": "0.2.0",

   "configurations": [

       {

           "name": "(gdb) Launch",

           "type": "node",

           "request": "launch",

           "cwd": "${workspaceFolder}",

           "program": "/home/farshid/code/vscode-test1/testCUDA",

           "args": [],

           "stopOnEntry": false,

           "runtimeExecutable": "/usr/bin/gdb",

           "runtimeArgs": [

               "--interpreter=mi2",

               "-ex", "set confirm off",

               "-ex", "tui enable",

               "-ex", "set startup-with-shell off",

               "-ex", "set substitute-path /usr/share/gdb /usr/local/cuda/bin",

               "-ex", "file ${workspaceFolder}/${fileBasenameNoExtension}",

               "-ex", "run",

               "--quiet"

           ],

           "env": {},

           "console": "integratedTerminal",

           "preLaunchTask": "build"

       }

   ]

}





c_cpp_properties.json


{

   "configurations": [

       {

           "name": "Jetson Nano - Debug",

           "includePath": [

               "${workspaceFolder}/**"

           ],

           "defines": [],

           "compilerPath": "/usr/local/cuda/bin/nvcc",

           "cStandard": "c11",

           "cppStandard": "c++17",

           "intelliSenseMode": "gcc-x64",

           "compilerArgs": [

               "-g",

               "-O0",

               "--compiler-options",

               "-Wall",

               "-Wextra",

               "-Wpedantic",

               "-Wno-deprecated-gpu-targets"

           ]

       }

   ],

   "version": 4

}





https://www.youtube.com/watch?v=11YfaGi0Fpk 

https://techcraft.co/videos/2022/2/vscode-on-ipad-pro-full-setup-guide-with-raspberry-pi/

00:00 VSCode on iPad Pro

00:44 Installing NodeJS

01:30 Install code-server

02:32 Default configuration

04:08 Connecting from Blink

05:53 Full screen Safari

07:10 Re-enable password authentication

07:34 Auto start code-server

09:38 Installing extensions

12:10 Secure mode