Programming wireless sensor networks is a major challenge, even for experienced programmers. To alleviate this problem, prior work has proposed a paradigm shift from node-level microprogramming to macroprogramming, where the user specifies a distributed application using a single macroprogram that is automatically translated into a set of node-level microprograms. This paper makes the case that node-level microprogramming itself can be made much easier by using the right set of programming abstractions. To support this claim, this paper presents μSETL, a programming abstraction for sensor networks based on {\it set theory}. Sets offer a powerful formalism and high expressiveness, yet are a natural way of thinking about resource abstraction in sensor networks. In addition to the set abstraction, μSETL features programming constructs that enable event-driven programming at a high level of abstraction, thereby significantly simplifying node-level microprogramming. μSETL consists of a set-based programming language, a compiler that translates μSETL programs into node-specific application code, and a runtime environment that provides various services to support the set-based programming abstraction. μSETL has been implemented using the Contiki operating system and runs on the Telos motes. Experimental results demonstrate that μSETL enables programmers to write various sensor network applications in a natural and highly compact manner with minimal overheads.