In this video lesson, we show you how to install Visual Studio Code (code-oss) on the NVIDIA Jetson Xavier NX. We take you through the process step by step. If you want to play along at home, you can get the gear you need HERE.
Arduino Tutorial 66: Controlling DC Motor, Speed and Direction with a Remote

In this lesson we develop a project that allow Remote Control of the speed and direction of a DC Motor. We use an Arduino Nano, and components from the Elegoo Kit. Also, to facilitate a clean build, we use Straight Jumper Wires.
The motor is connected according to this schematic:

Also, the remote control receiver is connected as follows: R on Remote to 5V, G on Remote to Ground, and Y on the Remote to Arduino Digital Pin 9. Go back and check out Tutorial 65 if you need more details on the Remote Module Connections.
In this video we will take you step by step through the build and coding for the project.
The code below is the software we developed in the video.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
#include <IRremote.h> int IRpin=9; IRrecv IR(IRpin); decode_results cmd; String myCom; int speedPin=5; int dir1=4; int dir2=3; int mSpeed=255; void setup() { Serial.begin(9600); IR.enableIRIn(); pinMode(speedPin,OUTPUT); pinMode(dir1,OUTPUT); pinMode(dir2,OUTPUT); digitalWrite(dir1,HIGH); digitalWrite(dir2,LOW); } void loop() { while (IR.decode(&cmd)==0){ } delay(1500); IR.resume(); if (cmd.value==0xFF6897){ myCom="zero"; Serial.println(myCom); } if (cmd.value==0xFF30CF){ myCom="one"; Serial.println(myCom); } if (cmd.value==0xFF18E7){ myCom="two"; Serial.println(myCom); } if (cmd.value==0xFF7A85){ myCom="three"; Serial.println(myCom); } if (cmd.value==0xFF10EF){ myCom="four"; Serial.println(myCom); } if (cmd.value==0xFF38C7){ myCom="five"; Serial.println(myCom); } if (cmd.value==0xFF5AA5){ myCom="six"; Serial.println(myCom); } if (cmd.value==0xFF42BD){ myCom="seven"; Serial.println(myCom); } if (cmd.value==0xFF4AB5){ myCom="eight"; Serial.println(myCom); } if (cmd.value==0xFF52AD){ myCom="nine"; Serial.println(myCom); } if (cmd.value==0xFFA25D){ myCom="pwr"; Serial.println(myCom); } if (cmd.value==0xFF629D){ myCom="v+"; Serial.println(myCom); } if (cmd.value==0xFFE21D){ myCom="fun"; Serial.println(myCom); } if (cmd.value==0xFF22DD){ myCom="rew"; Serial.println(myCom); } if (cmd.value==0xFF02FD){ myCom="play"; Serial.println(myCom); } if (cmd.value==0xFFC23D){ myCom="ff"; Serial.println(myCom); } if (cmd.value==0xFFE01F){ myCom="dn"; Serial.println(myCom); } if (cmd.value==0xFFA857){ myCom="v-"; Serial.println(myCom); } if (cmd.value==0xFF906F){ myCom="up"; Serial.println(myCom); } if (cmd.value==0xFF9867){ myCom="eq"; Serial.println(myCom); } if (cmd.value==0xFFB04F ){ myCom="st"; Serial.println(myCom); } if (myCom=="pwr"){ digitalWrite(dir1,LOW); digitalWrite(dir2,HIGH); analogWrite(speedPin,255); } if (myCom=="fun"){ digitalWrite(dir1,LOW); digitalWrite(dir2,HIGH); analogWrite(speedPin,0); } if (myCom=="ff"){ digitalWrite(dir1,LOW); digitalWrite(dir2,HIGH); analogWrite(speedPin,mSpeed); } if (myCom=="rew"){ digitalWrite(dir1,HIGH); digitalWrite(dir2,LOW); analogWrite(speedPin,mSpeed); } if (myCom=="up"){ mSpeed=mSpeed+15; if (mSpeed>255){ mSpeed=255; } analogWrite(speedPin,mSpeed); } if (myCom=="dn"){ mSpeed=mSpeed-15; if (mSpeed<0){ mSpeed=0; } analogWrite(speedPin,mSpeed); } } |
Jetson Xavier NX Lesson 4: Understanding and Using Gstreamer for Absolute Beginners
In this lesson we show you how to understand the great mystery known as Gstreamer. Most folks using the NVIDIA Jetson Nano or the NVIDIA Jetson Exavier NX just copy and past the launch string they found on the internet, but do not have a clue how Gstreamer actually works. In this video we will take you through it step-by-step, and show you how to actually understand what you are doing, and how to design your own pipes for maximum performance and image quality. Below are all the commands we used in the video lesson
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
gst-launch-1.0 audiotestsrc ! alsasink gst-inspect-1.0 audiotestsrc gst-launch-1.0 audiotestsrc freq=500 ! alsasink gst-launch-1.0 audiotestsrc freq=500 ! alsasink gst-inspect-1.0 audiotestsrc gst-launch-1.0 audiotestsrc freq=500 ! audio/x-raw, format=U8 ! alsasink gst-launch-1.0 audiotestsrc freq=500 ! audio/x-raw, format=U18LE ! alsasink gst-launch-1.0 audiotestsrc freq=500 ! audio/x-raw, format=U18LE ! audioconvert ! audio/x-raw, format=U8 ! alsasink gst-launch-1.0 videotestsrc ! ximagesink gst-inspect-1.0 videotestsrc gst-launch-1.0 videotestsrc pattern=11 ! ximagesink gst-launch-1.0 videotestsrc pattern=0 ! video/x-raw, format=BGR ! ximagesink gst-inspect-1.0 autovideoconvert gst-launch-1.0 videotestsrc pattern=0 ! video/x-raw, format=BGR ! autovideoconvert ! ximagesink gst-launch-1.0 videotestsrc pattern=0 ! video/x-raw, format=BGR ! autovideoconvert ! videoconvert ! video/x-raw, width=1280, height=960 ! ximagesink gst-launch-1.0 videotestsrc pattern=0 ! video/x-raw, format=BGR ! autovideoconvert ! videoconvert ! video/x-raw, width=1280, height=960, framerate=30/1 ! ximagesink gst-launch-1.0 videotestsrc pattern=0 ! video/x-raw, format=BGR ! autovideoconvert ! videoconvert ! video/x-raw, width=1280, height=960, framerate=1/1 ! ximagesink gst-launch-1.0 nvarguscamerasrc ! autovideo gst-launch-1.0 nvarguscamerasrc ! nvvidconv flip-method=2 ! video/x-raw,width=1280,height=840 ! autovideoconvert ! ximagesink gst-launch-1.0 nvarguscamerasrc ! "video/x-raw(memory:NVMM),width=3264,height=2464,format=NV12,framerate=21/1" ! nvvidconv flip-method=2 ! video/x-raw,width=640,height=480 ! autovideoconvert ! ximagesink gst-launch-1.0 nvarguscamerasrc ! "video/x-raw(memory:NVMM),width=3264,height=2464,format=NV12,framerate=21/1" ! nvvidconv flip-method=2 ! video/x-raw,width=640,height=480 ! autovideoconvert ! agingtv ! ximagesink gst-launch-1.0 nvarguscamerasrc ! "video/x-raw(memory:NVMM),width=3264,height=2464,format=NV12,framerate=21/1" ! nvvidconv flip-method=2 ! video/x-raw,width=640,height=480 ! autovideoconvert ! agingtv ! ximagesink gst-launch-1.0 nvarguscamerasrc ! "video/x-raw(memory:NVMM),width=3264,height=2464,format=NV12,framerate=21/1" ! nvvidconv flip-method=2 ! video/x-raw,width=1280,height=960 ! autovideoconvert ! agingtv ! coloreffects preset=sepia ! ximagesink gst-launch-1.0 v4l2src device=/dev/video1 ! xvimagesink gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,framerate=20/1,width=864,height=480 ! xvimagesink |
Arduino Tutorial 65: Creating Useful Commands from IR Remote Buttons

In this lesson we show you how to map button pushes on the Infrared Remote Control to useful functions in the Arduino. This code can serve as the basis for using the remote control in many different applications.
We are building this with parts from our Elegoo Kit , and our actual build is using an Arduino Nano, which allows the project to be built on a single breadboard. You can get the neat jumper wires HERE.
The code developed in the video is available below:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
#include <IRremote.h> int IRpin=9; IRrecv IR(IRpin); decode_results cmd; String myCom; void setup() { Serial.begin(9600); IR.enableIRIn(); } void loop() { while (IR.decode(&cmd)==0){ } delay(1500); IR.resume(); if (cmd.value==0xFF6897){ myCom="zero"; Serial.println(myCom); } if (cmd.value==0xFF30CF){ myCom="one"; Serial.println(myCom); } if (cmd.value==0xFF18E7){ myCom="two"; Serial.println(myCom); } if (cmd.value==0xFF7A85){ myCom="three"; Serial.println(myCom); } if (cmd.value==0xFF10EF){ myCom="four"; Serial.println(myCom); } if (cmd.value==0xFF38C7){ myCom="five"; Serial.println(myCom); } if (cmd.value==0xFF5AA5){ myCom="six"; Serial.println(myCom); } if (cmd.value==0xFF42BD){ myCom="seven"; Serial.println(myCom); } if (cmd.value==0xFF4AB5){ myCom="eight"; Serial.println(myCom); } if (cmd.value==0xFF52AD){ myCom="nine"; Serial.println(myCom); } if (cmd.value==0xFFA25D){ myCom="pwr"; Serial.println(myCom); } if (cmd.value==0xFF629D){ myCom="v+"; Serial.println(myCom); } if (cmd.value==0xFFE21D){ myCom="fun"; Serial.println(myCom); } if (cmd.value==0xFF22DD){ myCom="rew"; Serial.println(myCom); } if (cmd.value==0xFF02FD){ myCom="play"; Serial.println(myCom); } if (cmd.value==0xFFC23D){ myCom="ff"; Serial.println(myCom); } if (cmd.value==0xFFE01F){ myCom="dn"; Serial.println(myCom); } if (cmd.value==0xFFA857){ myCom="v-"; Serial.println(myCom); } if (cmd.value==0xFF906F){ myCom="up"; Serial.println(myCom); } if (cmd.value==0xFF9867){ myCom="eq"; Serial.println(myCom); } if (cmd.value==0xFFB04F ){ myCom="st"; Serial.println(myCom); } } |
Jetson Xavier NX Lesson 3: Using a WEB cam or Raspberry Pi camera in OpenCV with Gstreamer
In this video lesson we learn how to launch the Raspberry Pi Camera or a simple WEB cam on the Jetson Xavier NX using openCV and a Gstreamer command. This simple code shows you how to set up the camera, and then how to grab a frame and show a frame to create live video from the cameras.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import cv2 print(cv2.__version__) width=1280 height=720 flip=2 camSet='nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=21/1,format=NV12 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(width)+', height='+str(height)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink' #camSet ='v4l2src device=/dev/video1 ! video/x-raw,width='+str(width)+',height='+str(height)+',framerate=24/1 ! videoconvert ! appsink' cam=cv2.VideoCapture(camSet) while True: _, frame = cam.read() cv2.imshow('myCam',frame) cv2.moveWindow('myCam',0,0) if cv2.waitKey(1)==ord('q'): break cam.release() cv2.destroyAllWindows() |