How to setup the Edimax EW-7811Un 802.11n USB WiFi [Realtek RTL8188CUS] adapter on your Raspberry Pi

The easiest way is to use SSH from your PC to the Raspberry Pi. So start by connecting your Pi to your router via the Ethernet cable. On the Pi type
ifconfig
to get your ipaddress. On the PC login via SSH pi@[Enter Your IP], you will be asked for your Password, the default is raspberry but if you've changed it enter yours now.

Check the Pi sees your adapter

Run
lsusb
//Check this is in your list
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Modules

Run
lsmod
//Look for 8192cu

Connectivity Check

Run
iwconfig
//You should see
wlan0 unassociated Nickname:""
Mode:Managed Frequency:2.462 GHz Access Point: 20:3D:66:44:C6:70
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=100/100 Signal level=100/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Configure your Connection

Find and edit the file with your connection details.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
At the end of the file add the following. Substitute the "SSID" for your own network name and "PASSWORD" for the password to the network.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="PASSWORD"
}
.

Restart

sudo reboot

Test

ping google.com

Pinging google.com [2a00:1450:4009:816::200e] with 32 bytes of data:
Reply from 2a00:1450:4009:816::200e: time=19ms
Reply from 2a00:1450:4009:816::200e: time=20ms