Tens of billions of Internet of Things (IoT) devices together with roughly one smartphone per each inhabitant of this planet promise to fulfil the vision of anytime-anywhere computing. These computers already provide indispensable services in areas reaching from personal health, over smart home management, to precision agriculture. Despite their diversity, mobile and IoT devices are almost all characterised by a common trait - they are powered through small-capacity batteries. Consequently, resource-efficient operation is crucial. In this course we cover the foundations of programming these energy-constrained devices.