A teenager who got hooked on cannabis while at boarding school turned to dealing the drug to fund his habit.
Samuel Gilbert-Pike, 19, was sent away to school because he had learning difficulties and his parents thought it would help him.
But Gilbert-Pike said he got so bored that he started using drugs and, after finishing his education, turned to selling them to fund his habit.
Hannah Squire, prosecuting, told Swindon Crown Court on Friday that police stopped his car in Trowbridge on Thursday, July 18, last year.
Inside they found more than 150 grams of herbal cannabis, worth about £1,500, a large amount of sandwich bags and £278 in cash.
They then searched his home address where they found a further seven grams of the drug as well as a cannabis grinder.
When he was questioned he told the police his mum had found his stash and he was moving it and not involved in dealing.
But when his phone was examined it was found to be littered with references to dealing drugs including one reading 'I'm trying to sell my last two in bulk'.
Other incoming messages asked if he had anything, to which he replied 'not at the moment' and made reference slang terms for skunk cannabis.
Miss Squire told the court a police drugs expert said the texts suggested he was selling the cannabis in large, one ounce, deals.
And when Gilbert-Pike, of Ryeland Way, Trowbridge, was pulled over again a few months later he was found to have a small wrap of cocaine, which was for his own use.
He pleaded guilty to possessing cannabis with intent to supply and possession of cocaine.
Alex Daymond, defending, said: "He clearly comes from a very supportive close family and he knows by committing these offences he has badly let them down.
"He, like many young men of his age, fell into cannabis use largely because of boredom.
"You will see he has learning difficulties. As a result from a young age he was sent to boarding school.
"He found it very difficult boarding and fell into drug use at boarding school. He sold so other users who knew him.
"What was on his phone's messages reflected that selling. It was only to fund his habit. He has not smoked anything or used any cannabis since his last arrest."
He said as well as helping out elderly members of his family he also worked on their farm.
Passing sentence, Judge Tim Mousley QC said: "Because of your age and lack of convictions and responsibility in the family and prospects for the future I take the view I can suspend the sentence."
He imposed an eight month jail term, suspended for two years, and told him to do 120 hours of unpaid work, a year of supervision and imposed a drug rehabilitation requirement.