The 16-year-old boy was arrested after Staffordshire Police attended a report of a robbery in Hednesford.
The incident happened at about 4.20pm on Tuesday, in Station Road, and involved two teenage boys, who had been walking along the road when they were approached by two others, who tried to rob one of them.
The boys were able to escape, with the two would-be robbers then approaching another group before leaving.
The 16-year-old boy was later charged with possession of a bladed article in a public place and possession of cannabis.
He pleaded guilty to both charges at North Staffordshire Justice Centre on Thursday.
Sergeant Mark Burslem of Staffordshire Police’s Cannock neighbourhood team, said: “We would like to reassure people that at no point were the wider public in any danger.
"Officers will continue to patrol the area to offer the community reassurance."
The teenager has been referred to the Black Country Youth Court for sentencing on Wednesday, January 27.