The development – one of a number of new lessons on programming – aims to revitalise the teaching of computing science by making it more relevant.
Crucially, it also aims to equip a generation of pupils with the skills needed to drive future developments in the global computing industry. The move follows widespread concerns that too many schools teach computing in a passive way and do not make students aware of the career opportunities available.
Some schools have even closed computer science departments, blaming a lack of interest from pupils.
Last year, Google chief executive Eric Schmidt said the UK had failed to capitalise on its record of innovation in science and engineering, saying the country was throwing away its "great computer heritage" by failing to teach programming.
And this summer, Ian Livingstone, who co-authored an influential report on the future of the UK gaming industry, told The Herald that Scottish schools should give computer science the same prominence as physics, chemistry and mathematics.
Now, new materials have been developed for Scottish schools under a partnership between the British Computing Society and the Royal Society of Edinburgh.
Jeremy Scott, principal teacher of computing at George Heriot's School, in Edinburgh, who led the development work, said the subject had to be reinvented.
"Exams like Standard Grade had not been changed despite the rapid developments that have taken place in the subject in recent years," he said.
"It is so important we bring the subject up to date and connect with students in a way that resonates with them, and there is nothing better than smartphone technology to do that because it is a way of life for pupils now."
Mr Scott said that, as the subject was updated, course designers were also trying to embed a set of thinking practices that computer programmers routinely use to solve problems.
Under the new Curriculum for Excellence, courses are designed to develop problem-solving skills that serve pupils in later life, rather than just teaching facts to regurgitate in an exam.
Mr Scott said the ultimate ambition was to get computing science embedded in the curriculum and raise its profile as a subject.
"What made Scotland great in the industrial revolution was the skills learned in science technology and mathematics, and no-one questions the importance of teaching those subjects," he said.
"But we have had another industrial revolution and the subject that produced that was computing science, and yet it is not being delivered in the same way as other sciences.
"We have the chance to be a world leader and if we don't do this now then other countries such as China, India and Brazil will do it.
"This is not about creating a generation of smartphone mobile app developers – we are seeking to create a generation of pupils who leave schools comfortable with the use of computer code and who can take that learning further at university, college or in the workplace."
Eileen Prior, executive director of the Scottish Parent Teacher Council, said she welcomed the development.