p=10
f[t_]:=Which[-p≤t<-1,0,-1≤t≤1,1,1<t≤p,0]
q=Plot[f[t],{t,-p,p},PlotRange->All,PlotStyle->{Thickness[0.01],RGBColor[1,0,0]}]

a0=(1/(2*p))*(∫_(-p)^p)f[t]\[DifferentialD]t//FullSimplify
an=(1/p)*(∫_(-p)^p)f[t]*Cos[n*(Pi/p)*t]\[DifferentialD]t//TrigReduce
bn=(1/p)*(∫_(-p)^p)f[t]*Sin[n*(Pi/p)*t]\[DifferentialD]t//TrigReduce
c0=(1/(2*p))*(∫_(-p)^p)f[t]\[DifferentialD]t
cn=(1/(2*p))*(∫_(-p)^p)f[t]*(E^(-I*(((n*Pi)/p))*t))\[DifferentialD]t
F[ω_]=(∫_(-∞)^∞)f[t]*(E^(-I*t*ω))\[DifferentialD]t

a[n_]:=Which[n==0,a0,n≠0,an]
b[n_]:=bn
c[n_]:=Which[n==0,c0,n≠0,cn]

ac=Table[a[n],{n,0,20,1}];
bc=Table[b[n],{n,1,20,1}];
abc=Table[(Sqrt[(((a[n]))^2)+(((b[n]))^2)]),{n,1,20,1}];
acc=Table[Abs[c[n]],{n,-20,20,1}];
rcc=Table[Re[c[n]],{n,-20,20,1}];
icc=Table[Im[c[n]],{n,-20,20,1}];

BarChart[ac]
BarChart[bc]
BarChart[abc]
BarChart[acc]
BarChart[rcc]
BarChart[icc]

Plot[Abs[F[ω]],{ω,-10*p,10*p},PlotRange->All,PlotStyle->{Thickness[0.005],RGBColor[0,0,1]}]
Plot[Re[F[ω]],{ω,-10*p,10*p},PlotRange->All,PlotStyle->{Thickness[0.005],RGBColor[0,0,1]}]
Plot[Im[F[ω]],{ω,-10*p,10*p},PlotRange->All,PlotStyle->{Thickness[0.005],RGBColor[0,0,1]}]