Hi coders ,
I was wandering around to find a way to program Raspberry Pi over USB only . As I am lacking an HDMI cable I searched everywhere and found something useful. And I hope it should be available for everyone and I am presenting it for you , please note that this is a working trick for any of Raspberry Pi models which possess Wi-Fi connectivity.
Step 1: Setting Up Raspberry Pi
I am here using a raspberry pi zero w and this method is suitable for pi zero w . Raspberry Pi Zero W has two micro USB slots. One is only for powering and other for programming .
Step 2: Flashing OS to SD Card
Download RASPBIAN OS . Use any of bootable SD making software like ETCHERor RUFUS and make a bootable SD card with the downloaded image .
Step 3: Editing Files to Make Raspberry Pi Accessible With PuTTY
After reinserting SD card we can see a new device named boot and we need to edit some files before inserting it into Raspberry Pi .
Create a new file in boot name ssh with no extension which will enable SSH in Raspberry PiCreate a file called wpa_supplicant.conf . This is a configuration file that will allow you to pre configure the WiFi credentials. Paste this piece of code
On boot, the Pi will copy and use this as the default configuration file. In the file replace US with your country code and SSID and password with your credentials.
Step 4: Accessing Raspberry Pi Terminal With PuTTY
Insert the SD card to Raspberry Pi and wait to 90 seconds to boot . When Pi boot it will get connected to the Wi-Fi . Here I used my mobile hotspot as a network and connected my Raspberry Pi and my PC to the same hotspot which will make a network . Also it is easy to find out IP address of Raspberry Pi when connecting it to hotspot.
Provide IP address and open and we will get a terminal . Login with username as pi and password raspberry . Once you are logged in you get a terminal which is originally CLI of Raspberry Pi .
Step 5: ENABLING VNC SERVER
In the terminal type sudo raspi-config which gives you the configuration menu . Go to interfacing options of which choose VNC and enable it . Exit the terminal by finishing the process.
Step 6: Accessing Raspberry Pi GUI With VNC
Once you have enabled VNC Server go to VNC Viewer in your PC . Create a new connection by giving IP address of Raspberry Pi and give connection a new name . Invoke the device by double clicking on it , which will give you a login panel . Login with username pi default password raspberry . And here you get the Graphic User Interface. Check the whole thing and Code it out.