- To get started with Raspberry Pi, we have to store required OS on SD card.
- Now to store OS on SD card we need to install OS on SD card. If you want to know how to install/store OS on SD card you can refer Installing Operating System Image on SD card.
- Here, we installed the Raspbian OS on SD card.
- Now, we have an SD card with installed OS and Raspberry Pi Board.
- Initially to use raspberry Pi we need computer monitor or Digital Display.
- We can directly connect Raspberry Pi to the Digital Display using HDMI cable.
- But, if we have a computer monitor (VGA Display), then we need an HDMI to VGA converter along with a VGA cable for connecting Raspberry Pi with monitors. HDMI to VGA converter and VGA cable is shown below.
Now, connect the Raspberry Pi to the Display/monitor and Power-On Raspberry Pi. We will get a Black command window asking for Login and Password as shown below
- Then, use the following login name and password
raspberrypi Login: pi
Password: raspberry
- This is the default user name and password. You can change the password after the first login.
The above command window can be used to operate Raspberry Pi.
- To get GUI environment on Raspberry Pi, use below command,
startx
And we will get Home Screen of Raspberry Pi as shown below:
- On display, there is a symbol of raspberry to the top-left corner of display. After clicking on it, we will get menu as shown below,
- As we can see, the Raspbian OS has installed Python 2 & 3. It also has different programming IDE like Geany, BlueJ Java IDE, etc. As raspberry pi 3 has On-chip WiFi, we can connect it to the network and will get access over Internet.
- We can also change password of “Pi” user.
- To change password, click on preferences and then select Raspberry Pi Configuration which will provide a pop-up window.
- Then, click on change password option shown below.
Now, we are quite familiar with Raspberry Pi OS.
How to write C program on Raspbian OS
- So, let’s write our First C code on Raspbian and execute it.
- First Create Empty file and label it with .c extension.
- Now write a small program to print “Hello World”
Program
#include<stdio.h>
int main(){
printf(“Hello World”);
return 0;
}
After writing the code, open terminal (ctrl+alt+t) to execute it. Then, type following commands for compiling and execution.
Components Used |
||
---|---|---|
Raspberry Pi 4B Raspberry Pi 4BRaspberry Pi 4B |
X 1 | |
Raspberry Pi Zero Raspberry Pi Zero |
X 1 | |
HDMI Cables HDMI Cables |
X 1 |