Beam-target double-spin asymmetries and target single-spin asymmetries in exclusive π+ and quasiexclusive π- electroproduction were obtained from scattering of 1.6- to 5.7-GeV longitudinally polarized electrons from longitudinally polarized protons (for π+) and deuterons (for π-) using the CEBAF Large Acceptance Spectrometer (CLAS) at Jefferson Lab. The kinematic range covered is 1.1 \u3c W \u3c 2.6 GeV and 0.05 \u3c Q2 \u3c 5 GeV2, with good angular coverage in the forward hemisphere. The asymmetry results were divided into approximately 40 000 kinematic bins for π+ from free protons and 15 000 bins for π- production from bound nucleons in the deuteron. The present results are found to be in reasonable agreement with fits to previous world data for W \u3c 1.7 GeV and Q2 \u3c 0.5 GeV2, with discrepancies increasing at higher values of Q2, especially for W \u3e 1.5 GeV. Very large target-spin asymmetries are observed for W \u3e 1.6 GeV. When combined with cross-section measurements, the present results can provide powerful constraints on nucleon resonance amplitudes at moderate and large values of Q2, for resonances with masses as high as 2.3 GeV