In the Samyutta Nikaya's "Fire Discourse," the Buddha identifies that mindfulness is "always useful" (sabbatthika); while, when one's mind is sluggish, one should develop the enlightenment factors of investigation, energy and joy; and, when one's mind is excited, one should develop the enlightenment factors of tranquility, concentration and equanimity.
Again according to the Samyutta Nikaya, once when the Buddha was gravely ill he asked Venerable Mahacunda to recite the seven Factors of Enlightenment to him. In such a way the Buddha was cured of his illness.
Abhidhamma and commentarial literature
In the Visuddhimagga, in a section discussing skills needed for the attainment and maintenance of absorption (jhana), Buddhaghosa identifies the bojjhangas in the following fashion:
"Strong mindfulness ... is needed in all instances...."
"When his mind is slack with over-laxness of energy, etc., then ... he should develop those [three enlightenment factors] beginning with investigation-of-states..." (i.e., dhamma vicaya, viriya, piti).
"When his mind is agitated through over-energeticness, etc., then ... he should develop those [three enlightenment factors] beginning with tranquility..." (i.e., passaddhi, samadhi, upekkha).
Balancing enlightenment factors & hindrances
Joy or rapture (pīti)
Investigation (dhamma vicaya)
to be used when experiencing sloth & torpor (thīna-middha) to regain mindfulness
the balancing factor
to be used when experiencing restlessness & worry (uddhacca-kukkucca) to regain mindfulness
The seven factors of awakening are closely related to the practice of dhyana, resembling the various factors that are part of the four dhyanas.
In meditation everyone most likely experiences two of the five hindrances (Pāli: pañca nīvaraṇāni). They are sloth and torpor (Pāli: thīna-middha), which is half-hearted action with little or no collectedness, and restlessness and worry (uddhacca-kukkucca), which is the inability to calm the mind.
As indicated above, in the "Fire Discourse" (SN 46.53), it is recommended that joy or rapture, investigation, and energy are to be developed when experiencing sloth and torpor. Relaxation, concentration, and equanimity are to be developed when experiencing restlessness or worry. Mindfulness should be constantly present to remain aware of physical change as well as mental change in either skillful or unskillful direction.
^See, e.g., Rhys Davids & Stede (1921-25), entry for "Samādhi," retrieved 3 Feb. 2011 from "U.Chicago" at "Archived copy". Archived from the original on 2012-07-09. Retrieved 2012-08-17.CS1 maint: archived copy as title (link) .
^Bhikkhu Sutta (SN 46.5), trans. Bodhi (2000), p. 1574. See also Walshe (1985), n. 265.
^For an example of a discourse that includes the juxtaposition of these two sets of phenomena, see the Satipatthana Sutta. For a group of discourses in which these two sets of phenomena are juxtaposed, see SN 46.31 to 46.40 (Bodhi, 2000, pp. 1501, 1589-94).
^SN 46.54, variously known as the Mettaasahagata Sutta (CSCD) or Metta Sutta (SLTP) or Metta.m Sutta (PTS Feer). See Bodhi (2000), pp. 1607-11; Walshe (1985), sutta 59, pp. 71-73.
^ ab"Fire Discourse" (Aggi Sutta, SN 46.53) (Bodhi, 2000, pp. 1605-7; Walshe, 1985, sutta 58, pp. 69-70).
^Buddhaghosa & Ñāṇamoli (1999), pp. 129, 131. Note that Buddhaghosa clearly references the last six bojjhangas in the last two cited statements. The first statement about sati (mindfulness), while immediately preceding mention of the bojjhangas, is technically in reference to the five spiritual faculties (indriya). See also SN 46.53 (Bodhi, 2000, pp. 1605-7; Walshe, 1985, sutta 58, pp. 69-70).
^Gethin, Tha Buddhis Path to Awakening, chapter five; Arbel (2017), Early Buddhist Meditation